Mapbox GL JS 平铺错误?
Mapbox GL JS tiling faulty?
Messed Up Tiling
我 运行 遇到了一个问题,我可以很好地加载我的图块,但它们在地图视图中的位置完全错误。这发生在所有超过 0 的缩放级别上(因为 0 显然只是一个完整的图像)
我是 运行 一个 tileserver-php tileserver,提供来自 mbtiles 文件的解压矢量切片。我已经设法让它们工作了,但是分辨率在超出 maxzoom 的 openlayers 上变得很糟糕(好像矢量没有正确更新它们自己的分辨率)。
在 Mapbox GL JS 上,我加载了它们,但现在面临这个问题。
var simple = {
"version": 8,
"sources": {
"osm": {
"tiles": ["http://localhost:8000/tileserver/nederland/{z}/{x}/{y}.vector.pbf"],
"type": "vector",
"maxzoom": 14
}
},
"style": {
// this styling is about 600 lines long so I'm not including it
}
}
var map = new mapboxgl.Map({
container: "map",
style: simple,
//maxBounds: [[2.992192,50.74753],[7.230455,54.01786]],
zoom: 1,
center: [5.8, 53.2]
});
使用 OpenLayers,我可以像这样设置平铺网格:
function tileUrlFunction(tileCoord) {
return ("http://localhost:8000/tileserver/nederland/{z}/{y}/{x}.vector.pbf")
.replace("{z}", String(tileCoord[0]))
.replace("{x}", String(tileCoord[1]))
.replace("{y}", String(-tileCoord[2] - 1));
}
这也适用于 Mapbox GL 还是其他地方出了问题?
我试过以下:
- 将 URL 更改为不同的格式({x}/{y}/{z}、{z}/{y}/{x} 等)。有趣的是,这固定了左侧图块或上方图块的垂直或水平定位,但不是两者都固定。
@sabas 是对的。
尽管它似乎是 tileserver-php 框架中的标准..在那之后;我将字符串替换为如下所示:{z}/{y}/{x} 现在可以使用了。
Messed Up Tiling
我 运行 遇到了一个问题,我可以很好地加载我的图块,但它们在地图视图中的位置完全错误。这发生在所有超过 0 的缩放级别上(因为 0 显然只是一个完整的图像)
我是 运行 一个 tileserver-php tileserver,提供来自 mbtiles 文件的解压矢量切片。我已经设法让它们工作了,但是分辨率在超出 maxzoom 的 openlayers 上变得很糟糕(好像矢量没有正确更新它们自己的分辨率)。
在 Mapbox GL JS 上,我加载了它们,但现在面临这个问题。
var simple = {
"version": 8,
"sources": {
"osm": {
"tiles": ["http://localhost:8000/tileserver/nederland/{z}/{x}/{y}.vector.pbf"],
"type": "vector",
"maxzoom": 14
}
},
"style": {
// this styling is about 600 lines long so I'm not including it
}
}
var map = new mapboxgl.Map({
container: "map",
style: simple,
//maxBounds: [[2.992192,50.74753],[7.230455,54.01786]],
zoom: 1,
center: [5.8, 53.2]
});
使用 OpenLayers,我可以像这样设置平铺网格:
function tileUrlFunction(tileCoord) {
return ("http://localhost:8000/tileserver/nederland/{z}/{y}/{x}.vector.pbf")
.replace("{z}", String(tileCoord[0]))
.replace("{x}", String(tileCoord[1]))
.replace("{y}", String(-tileCoord[2] - 1));
}
这也适用于 Mapbox GL 还是其他地方出了问题?
我试过以下: - 将 URL 更改为不同的格式({x}/{y}/{z}、{z}/{y}/{x} 等)。有趣的是,这固定了左侧图块或上方图块的垂直或水平定位,但不是两者都固定。
@sabas 是对的。
尽管它似乎是 tileserver-php 框架中的标准..在那之后;我将字符串替换为如下所示:{z}/{y}/{x} 现在可以使用了。