MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / getVectorTileCRSExtent

Function getVectorTileCRSExtent

src/maplibregl/mapping/InitMap.js:128–141  ·  view source on GitHub ↗

* @private * @function getVectorTileCRSExtent * @description 获取矢量瓦片坐标系范围。 * @param {string} vectorStyleUrl - 矢量瓦片 style json 服务地址。 * @param {string} restMapUrl - 矢量瓦片 rest 地图服务地址。 * @returns {Object}

(vectorStyleUrl, restMapUrl)

Source from the content-addressed store, hash-verified

126 * @returns {Object}
127 */
128async function getVectorTileCRSExtent(vectorStyleUrl, restMapUrl) {
129 try {
130 const vectorStyleDataRes = await FetchRequest.get(vectorStyleUrl);
131 const vectorStyleData = await vectorStyleDataRes.json();
132 if (vectorStyleData.metadata && vectorStyleData.metadata.indexbounds) {
133 return { extent: vectorStyleData.metadata.indexbounds };
134 }
135 const vectorExtentDataRes = await FetchRequest.get(`${restMapUrl}/prjCoordSys/projection/extent.json`);
136 const vectorExtentData = await vectorExtentDataRes.json();
137 return { extent: vectorExtentData, center: vectorStyleData.center };
138 } catch (error) {
139 return { extent: [] };
140 }
141}
142
143/**
144 * @private

Callers 1

createMapOptionsFunction · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected