我正在使用 leaflet-bing-layer
插件,以便在 Leaflet 中添加一个基于 Bing 的地图。
由于我还使用了 OSM,因此我导入了 leaflet
和 leaflet-bing-layer
两个插件。
导入语句如下:
import * as L from 'leaflet';
import * as B from 'leaflet-bing-layer';
LeafletMapComponent中使用Leaflet:
constructor () {
this.baseMaps = {
OpenStreetMap: L.tileLayer ("https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>, Tiles courtesy of <a href="https://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
}),
BingMap: B.tileLayer.bing(LeafletMapComponent.BING_KEY, {type: 'AerialWithLabels'})
};
}
很遗憾,Ling BingMap: B.tileLayer.bing(...
出现错误:无法读取未定义的属性 'bing'
我没有找到任何在Angular和Typescript中使用Bing地图的可用示例,所以我猜这里可能有些内容缺失。
您有什么想法吗?我做错了什么?
B
的值是多少? - IvanSanchez