如何删除使用apply方法加载的ol-mapbox样式图层

问题描述

由于大多数时候我都是通过使用addLayer()和removeLayer()OL方法添加和删除图层的,所以我该如何类似地处理以ol-mapbox样式处理的矢量图层?以下角度代码不起作用,我在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))

}

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)