我遇到了Mapbox-GL-JS的问题,我的浏览器中有缓存的矢量切片,阻止了最近的更改。正常的解决方法是在tile字符串的末尾附加一个唯一的字符串(example.com/tiles/1/2/3.png?update=1
),但我不确定如何在Mapbox-GL-JS中使用它,因为它构造了tile字符串对我来说,来自复合层:
...
metadata": {
"mapbox:autocomposite": true,
"mapbox:type": "default"
},
"sources": {
"mapbox": {
"url": "mapbox://mapbox.satellite",
"type": "raster",
"tileSize": 256
},
"composite": {
"url": "mapbox://stevage.9vj4wkw3,mapbox.mapbox-streets-v7,stevage.ab95cml8",
"type": "vector"
}
},
有没有办法强制一些额外的文字到网址?
答案 0 :(得分:5)
将保留mapbox://
网址末尾的所有查询参数。您可能会发现有趣的fresh
参数,我们有特殊的参数来跳过大多数API端缓存。
...
metadata": {
"mapbox:autocomposite": true,
"mapbox:type": "default"
},
"sources": {
"mapbox": {
"url": "mapbox://mapbox.satellite?fresh=true",
"type": "raster",
"tileSize": 256
},
"composite": {
"url": "mapbox://stevage.9vj4wkw3,mapbox.mapbox-streets-v7,stevage.ab95cml8?fresh=true",
"type": "vector"
}
},