raster-dem: let inline minzoom/maxzoom override the TileJSON - #4557
Open
AndrewN81 wants to merge 2 commits into
Open
raster-dem: let inline minzoom/maxzoom override the TileJSON#4557AndrewN81 wants to merge 2 commits into
AndrewN81 wants to merge 2 commits into
Conversation
A raster-dem source given by `url` replaced its tileset with the fetched TileJSON, dropping any inline `minzoom`/`maxzoom` from the style. maplibre-gl-js does the opposite (`extend(tileJSON, options)` in load_tilejson.ts), so a style that declares a higher `maxzoom` than an archive's stored ceiling works on the web and not here. With 3D terrain this matters: the mesh and its drape targets go no deeper than the DEM source's declared maxzoom, so a PMTiles DEM that stops at z12 pinned the whole draped map to z12 textures and every road blurred past z13. Declaring `maxzoom: 16` inline now takes effect and the DEM overzooms from its z12 ancestors. SourceOptions gains minzoom/maxzoom, parsed alongside `encoding`, and RasterDEMSource::setTilesetOverrides applies them after the TileJSON. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
AndrewN81
marked this pull request as ready for review
September 5, 2026 10:24
louwers
reviewed
Sep 5, 2026
| struct SourceOptions { | ||
| std::optional<Tileset::RasterEncoding> rasterEncoding = std::nullopt; | ||
| std::optional<Tileset::VectorEncoding> vectorEncoding = std::nullopt; | ||
| // Inline style overrides applied on top of a fetched TileJSON, matching maplibre-gl-js |
Member
There was a problem hiding this comment.
If you want to reference a source file in another repo, it better be a permalink.
Author
There was a problem hiding this comment.
Done, it now links the gl-js line by commit permalink.
…s reference - SourceOptions conversion: zoom range parsed alone and alongside encoding, wrong type and out-of-range values rejected with 'invalid minzoom/maxzoom'. - RasterDEMSource: the inline maxzoom replaces the TileJSON's after loadDescription while an unset minzoom keeps the TileJSON value; without inline options the TileJSON range is kept unchanged. - Point the comment in raster_dem_source.hpp at a maplibre-gl-js permalink. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Author
|
Added unit tests in ce4876b:
Checked that the override test fails against the previous code (max stays at the TileJSON's 12) and passes with the change. All 17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A
raster-demsource's inlineminzoom/maxzoomare ignored on native when the source also has a TileJSON (url, or a PMTiles archive header): the TileJSON's zoom range replaces them. maplibre-gl-js lets the inline values win. The practical effect on this branch: a Terrarium PMTiles archive with a z12 header pins the terrain mesh and the drape cover at z12, so every road and building goes soft as soon as the map is tilted at z14+, even though the style asked formaxzoom: 16(overzoom).RasterDEMSourcenow records inlineminzoom/maxzoomfrom the style (SourceOptions) and reapplies them over the loaded tileset's zoom range, matching gl-js precedence.How it was verified
maxzoom: 16honoured, the drape is rendered from z14 tiles and roads stay crisp; before, identical output formaxzoom14 and 16 (both ignored, cover stuck at the archive's z12).Notes
Written with AI assistance (Claude), reviewed and tested by me before opening this PR, per MapLibre's AI policy.