Mapbox GL JS平铺有问题?

问题描述 投票:0回答:1

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一样,还是其他地方搞砸了?

我尝试过以下操作: - 将网址更改为其他格式({x} / {y} / {z},{z} / {y} / {x}等)。这足够有趣,固定左侧瓷砖或上部瓷砖的垂直或水平定位,但不是两者。

javascript mapbox mapbox-gl-js
1个回答
1
投票

@sabas是对的。

虽然它似乎是tileserver-php框架中的标准..之后;我将字符串替换为如下所示:{z} / {y} / {x},现在可以正常工作了。

© www.soinside.com 2019 - 2024. All rights reserved.