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

Function getVectorTileCRSExtent

src/mapboxgl/mapping/InitMap.js:135–148  ·  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

133 * @returns {Object}
134 */
135async function getVectorTileCRSExtent(vectorStyleUrl, restMapUrl) {
136 try {
137 const vectorStyleDataRes = await FetchRequest.get(vectorStyleUrl);
138 const vectorStyleData = await vectorStyleDataRes.json();
139 if (vectorStyleData.metadata && vectorStyleData.metadata.indexbounds) {
140 return { extent: vectorStyleData.metadata.indexbounds };
141 }
142 const vectorExtentDataRes = await FetchRequest.get(Util.urlPathAppend(restMapUrl, 'prjCoordSys/projection/extent.json'));
143 const vectorExtentData = await vectorExtentDataRes.json();
144 return { extent: vectorExtentData, center: vectorStyleData.center };
145 } catch (error) {
146 return { extent: [] };
147 }
148}
149
150/**
151 * @private

Callers 1

createMapOptionsFunction · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected