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

Method _createBingLayer

src/common/mapping/WebMapV2.js:751–771  ·  view source on GitHub ↗
(layerName, layerInfo, addedCallback)

Source from the content-addressed store, hash-verified

749 }
750
751 async _createBingLayer(layerName, layerInfo, addedCallback) {
752 let metaInfoUrl = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/RoadOnDemand?uriScheme=https&include=ImageryProviders&key=${this.bingMapsKey}&c=zh-cn`;
753 const metaInfo = await this._fetchRequest(metaInfoUrl, 'json', {
754 withoutFormatSuffix: true
755 });
756 if (
757 metaInfo.statusCode !== 200 ||
758 metaInfo.resourceSets.length !== 1 ||
759 metaInfo.resourceSets[0].resources.length !== 1
760 ) {
761 return;
762 }
763 const resource = metaInfo.resourceSets[0].resources[0];
764 const urls = resource.imageUrlSubdomains.map((subdomain) => {
765 const imageUrl = resource.imageUrl.replace('{subdomain}', subdomain);
766 return imageUrl;
767 });
768
769 this._addBaselayer({ url: urls, layerID: layerName, visibility: layerInfo.visible, bounds: INTERNET_MAP_BOUNDS['BING'] });
770 addedCallback && addedCallback();
771 }
772
773 _createXYZLayer(layerInfo, url, addedCallback) {
774 let urlArr = [];

Callers 1

_initBaseLayerMethod · 0.95

Calls 3

_fetchRequestMethod · 0.95
_addBaselayerMethod · 0.95
mapMethod · 0.80

Tested by

no test coverage detected