function handleChange() {
const baseLayer = window.olMap.getAllLayers()[0] // 获取当前map的底图
window.olMap.removeLayer(baseLayer) // 移除该底图
const mapLayers = window.olMap.getLayers() // 获取当前地图中的所有图层
mapLayers.insertAt(
0,
new Tile({
source: new TileArcGISRest({
url: 'https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer'
})
})
) // 将新的图层对象插入到第一个位置。
}
vue3 + openlayers---底图切换
最新推荐文章于 2024-07-07 18:07:41 发布