iClient-JavaScript icon indicating copy to clipboard operation
iClient-JavaScript copied to clipboard

raster-dem generates TILEMATRIX=NaN under EPSG:4490 custom CRS

Open FiyaZg opened this issue 7 months ago • 3 comments

Hi SuperMap team,

I am testing maplibre-gl-enhance.js with a custom CRS, specifically EPSG:4490 / CGCS2000.

Currently, I can successfully initialize the map with a custom CRS and load 2D vector tiles and WMTS raster tiles in EPSG:4490. For example, a Tianditu ter_c WMTS layer works correctly when used as a normal raster source.

However, when I use the same 4490 WMTS tile URL as a raster-dem source and call map.setTerrain(), the generated tile request contains TILEMATRIX=NaN.

Example:

map.addSource('dem-test', {
  type: 'raster-dem',
  tiles: [
    'https://t0.tianditu.gov.cn/ter_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ter&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=xxxx'
  ],
  tileSize: 256,
  encoding: 'mapbox'
})

map.setTerrain({
  source: 'dem-test',
  exaggeration: 1
})

But when I use the same URL as a normal raster source, {z}, {x}, and {y} are replaced correctly, and the layer loads normally.

So I would like to confirm:

Does maplibre-gl-enhance.js support raster-dem sources under custom CRS such as EPSG:4490? Does it support map.setTerrain() with custom CRS / non-WebMercator tile matrix sets? If supported, is there any required configuration or example for loading DEM terrain in EPSG:4490? If not supported currently, is this a known limitation of the terrain / raster-dem pipeline?

Thank you.

FiyaZg avatar Apr 27 '26 08:04 FiyaZg

谢谢您提的issue,看到您应该是会中文的 ,我直接中文回复你 1 、maplibre-gl-enhance.js support raster-dem sources under custom CRS such as EPSG:4490? 支持的 2、Does it support map.setTerrain() with custom CRS / non-WebMercator tile matrix sets 支持的 可以提供下你的wmts的capabilitie文档(可以抹去关键信息,只要保留tilematrixsets就行)和与这个wmts匹配的完整代码吗

songyumeng avatar Apr 27 '26 09:04 songyumeng

谢谢您提的issue,看到您应该是会中文的 ,我直接中文回复你 1 、maplibre-gl-enhance.js support raster-dem sources under custom CRS such as EPSG:4490? 支持的 2、Does it support map.setTerrain() with custom CRS / non-WebMercator tile matrix sets 支持的 可以提供下你的wmts的capabilitie文档(可以抹去关键信息,只要保留tilematrixsets就行)和与这个wmts匹配的完整代码吗

你好,感谢回复。以下是去敏的wmts的capabilitie文档和demo,以及出现tileMatrix=NaN 的失败请求URL wmts.xml

supermap-maplibre-enhance-4490-dem-repo.html

http://example.com/rest/dem_china2000/wmts?service=WMTS&request=GetTile&version=1.0.0&layer=dem_china2000&style=default&tileMatrixSet=guobiao&tileMatrix=NaN&tileRow=1025&tileCol=7065&format=image%2Fjpgpng

谢谢!

FiyaZg avatar Apr 28 '26 05:04 FiyaZg

https://iclient.supermap.io/web/libs/maplibre-gl-js-enhance/5.9.0/maplibre-gl-enhance.js 使用下这个较新的maplibre-gl-enhance.js

songyumeng avatar Apr 28 '26 08:04 songyumeng