Error: RGB terrain shifted -10000 when rendered using 3d terrain (raster-dem) Maplibre GL
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 125
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I am developing a 3D terrain using Maplibre GL, i want to use my own DEM data to visualize the terrain. I have converted DEM with EPSG:3857 into RGB terrain by utilizing water-gis tools. The tools comply with the MaplibreGL equation: height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1).
Nonetheless, when i tried to visualize the raster-tiles into the raster-dem there is a vertical distortion occurred, it is shifted vertically, the picture as follows:
To debug this error, i have tried to change the base of the equation from (-10000) to (0) but it turns out that evoke other error to the terrain. The zoom level can only enable until 12, after that the map returns blank white screen. The base still shifted vertically but not as significant when the base is (-10000), picture as follows:
Other debugging effort is by customizing the encoding of maplibre, the code as follows:
// Use a different source for terrain and hillshade layers, to improve render quality
terrainSource: {
type: 'raster-dem',
// url: 'https://demotiles.maplibre.org/terrain-tiles/tiles.json',
tiles: ['http://localhost:5173/BDGtiles/{z}/{x}/{y}.png'],
tileSize: 256,
encoding: "custom",
baseShift: 10000,
redFactor: 0,
greenFactor:1,
blueFactor:1
}
The terrain touches the ground with this method but the terrain surface getting rougher and abstract. image as follows:
How can i repair the base shifting issue from -10000 to 0 without causing any other bug?
Thank You
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the RGB terrain data, the MapLibre GL raster-dem configuration, and the documented height equation. Compare the -10000 and 0 base values and the custom encoding settings, including the zoom levels where rendering becomes blank. Done means the terrain aligns with the ground without vertical shifting, rough surfaces, or blank rendering at higher zooms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100