由于大多数时候我使用 addLayer() 和 removeLayer() OL 方法添加和删除图层,我如何处理类似使用 ol-mapbox-style 处理的矢量图层?以下角度代码不起作用,我在https://github.com/openlayers/ol-mapbox-style中看不到合适的方式。
changeToVectorTileMapTilerEmbebedJson() {
apply(
this.map,
'https://api.maptiler.com/maps/b3265770-0173-4415-909d-264ef9934779/style.json?key=blablabla'
)
.then(() => this.map.removeLayer(this.stamenTerrain))
.then(() => this.map.removeLayer(this.stamenWaterColor))
.then(() => this.map.removeLayer(this.osm))
.then(() => this.map.removeLayer(this.topMap))
.then(() => this.map.removeLayer(this.vectorTileMapTilerHillShades))
.then(() => this.map.removeLayer(this.vectorTileMapTilerSatMediumbres))
.then(() => this.map.removeLayer(this.vectorTileArcGISpbf))
}
谢谢