(layerName, layerInfo, addedCallback)
| 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 = []; |
no test coverage detected