修复切换地图坐标系时未更新矢量瓦片坐标系

This commit is contained in:
lin
2025-11-13 16:17:29 +08:00
parent 7704c3a7fb
commit ec7567c2cd
4 changed files with 10 additions and 8 deletions

View File

@@ -97,8 +97,6 @@ export default {
url: this.mapTileList[this.mapTileIndex].tilesUrl
})
})
console.log(4444)
console.log(this.mapTileList[this.mapTileIndex].tilesUrl)
} else {
tileLayer = new Tile({
preload: 4,
@@ -150,11 +148,11 @@ export default {
})
},
addVectorTileLayer(tileUrl, clickEvent, errorEvent){
tileUrl += `?geoCoordSys=${this.mapTileList[this.mapTileIndex].coordinateSystem}&accessToken=${this.$store.getters.token}`
let source = new VectorTileSource({
format: new MVT(),
url: tileUrl
})
let layer = new VectorTileLayer({
source: source,
style: function(feature) {
@@ -625,6 +623,7 @@ export default {
this.mapTileIndex = index
window.coordinateSystem = this.mapTileList[this.mapTileIndex].coordinateSystem
tileLayer.getSource().setUrl(this.mapTileList[index].tilesUrl)
tileLayer.getSource().refresh()
if (mapTileConfig.coordinateSystem !== this.mapTileList[this.mapTileIndex].coordinateSystem) {
// 发送通知
this.$emit('coordinateSystemChange', this.mapTileList[this.mapTileIndex].coordinateSystem)