MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / getTileLayerInfo

Method getTileLayerInfo

src/openlayers/mapping/WebMap.js:4483–4518  ·  view source on GitHub ↗

* @private * @function WebMap.prototype.getTileLayerInfo * @description 获取地图服务的信息 * @param {string} url 地图服务的url(没有地图名字) * @param {boolean | undefined} proxy 是否需要代理 * @returns {Promise } 地图服务信息

(url, proxy)

Source from the content-addressed store, hash-verified

4481 * @returns {Promise<T | never>} 地图服务信息
4482 */
4483 getTileLayerInfo(url, proxy) {
4484 let that = this,
4485 epsgCode = that.baseProjection.split('EPSG:')[1];
4486 let requestUrl = that.getRequestUrl(`${url}/maps.json`, proxy);
4487 return FetchRequest.get(requestUrl, null, {
4488 withCredentials: this.isCredentail(url, proxy)
4489 })
4490 .then(function (response) {
4491 return response.json();
4492 })
4493 .then(function (mapInfo) {
4494 let promises = [];
4495 if (mapInfo) {
4496 mapInfo.forEach(function (info) {
4497 let mapUrl = that.getRequestUrl(
4498 `${info.path}.json?prjCoordSys=${encodeURI(JSON.stringify({ epsgCode: epsgCode }))}`,
4499 proxy
4500 );
4501 let promise = FetchRequest.get(mapUrl, null, {
4502 withCredentials: that.isCredentail(mapUrl, proxy)
4503 })
4504 .then(function (response) {
4505 return response.json();
4506 })
4507 .then(function (restMapInfo) {
4508 restMapInfo.url = info.path;
4509 return restMapInfo;
4510 });
4511 promises.push(promise);
4512 });
4513 }
4514 return Promise.all(promises).then(function (allRestMaps) {
4515 return allRestMaps;
4516 });
4517 });
4518 }
4519
4520 /**
4521 * 通过 WKT 参数扩展支持多坐标系。

Callers 1

Calls 5

isCredentailMethod · 0.95
getRequestUrlMethod · 0.80
forEachMethod · 0.80
pushMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected