hongfaqiu / MVTImageryProvider

Mapbox vector tiles(pbf) visulization on cesium
https://mvt-provider.opendde.com/
MIT License
63 stars 19 forks source link

你好,MVTImageryProvider 能加上 tileMatrixLabels 吗? #21

Closed quater23 closed 10 months ago

quater23 commented 10 months ago

服务和Cesium的格网差一级,希望能允许传入自定义的 tileMatrixLabels,类似 WebMapTileServiceImageryProvider,比如下面这样:

constructor(){
   this._tileMatrixLabels = options.tileMatrixLabels;
}
...
_getTilesSpec(coord, source){
   let { x, y, level } = coord;
   level = defined(this._tileMatrixLabels) ? this._tileMatrixLabels[level] : level;
   ...
}

谢谢!

hongfaqiu commented 10 months ago

切片规则一样吗?就是0级为1x1,1级为2x2

quater23 commented 10 months ago

切片规则一样吗?就是0级为1x1,1级为2x2

一样,只不过是地理投影的;

且元数据的 tileMatrix.Identifier 的最大级不是 0 而是 1 ,类似天地图:(https://[t0.tianditu.gov.cn/img_c/wmts?tk=11f857f20459a3ca5db75f50b8c4d7e4&VERSION=1.0.0&REQUEST=GetCapabilities&SERVICE=WMTS](https://t0.tianditu.gov.cn/img_c/wmts?tk=11f857f20459a3ca5db75f50b8c4d7e4&VERSION=1.0.0&REQUEST=GetCapabilities&SERVICE=WMTS));

所以需要自己传tileMatrixLabels

hongfaqiu commented 10 months ago

TMS规范应该是没有tileMatrixLabels参数的,想要给请求的url层级加一,可以使用transformRequest参数

MVTImageryProvider.fromUrl(YOUR_STYLE_URL, {
  transformRequest: (url => {
    const updatedURL = url.replace(/\d+(?=\.pbf$)/, (match) => String(Number(match) + 1));

    return { url: updatedURL };
  })
})
quater23 commented 7 months ago

TMS规范应该是没有tileMatrixLabels参数的,想要给请求的url层级加一,可以使用transformRequest参数

MVTImageryProvider.fromUrl(YOUR_STYLE_URL, {
  transformRequest: (url => {
    const updatedURL = url.replace(/\d+(?=\.pbf$)/, (match) => String(Number(match) + 1));

    return { url: updatedURL };
  })
})

好的,谢谢!