feat(TileMap): add terrain and pitch props, upgrade to MapLibre 6.3 - #495
Open
palewire wants to merge 1 commit into
Open
feat(TileMap): add terrain and pitch props, upgrade to MapLibre 6.3#495palewire wants to merge 1 commit into
palewire wants to merge 1 commit into
Conversation
Terrain was documented as a hand-rolled onMapReady closure, and the Terrain story passed exaggeration: 120 -- a multiplier, which made Everest about 1,000 km tall and produced degenerate geometry. Give TileMap first-class terrain and pitch props instead. terrain accepts true or a numeric exaggeration, warns and no-ops when the style lacks the DEM source, and the story reduces to declarative markup. Upgrading maplibre-gl from 5.15 to 6.3 required three fixes: - MapLibre 6 is ESM-only with no default export, so three default imports become namespace imports. - setPaintProperty and setLayoutProperty are now generic over the style spec property maps. Those types are not re-exported by maplibre-gl and the style-spec package is not a direct dependency, so TileMapLayer derives them from the method signatures instead. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🦋 Changeset detectedLatest commit: e3f1957 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Follow-up to #492, which landed the terrain docs. This lands the actual component work — it was written against that branch but got stranded when #492 merged first, so it never reached
main.terrainandpitchpropsTerrain was a hand-rolled
onMapReadyclosure.TileMapnow takes it directly:terrainacceptstrueor a numeric exaggeration. It warns and no-ops when the style lacks the DEM source, so a project pinned to an older style fails loudly instead of silently rendering nothing — which is exactly what made the original bug so hard to see.maplibre-gl 5.15 → 6.3
Upgraded rather than backported. Three things broke:
import maplibregl from 'maplibre-gl'now yieldsundefined. Three default imports became namespace imports (TileMap,TileMapCallout,TemperatureToggledocs).setPaintProperty/setLayoutPropertyare now generic over the style-spec property maps. Those types aren't re-exported bymaplibre-gl, and@maplibre/maplibre-gl-style-specisn't a direct dependency, soTileMapLayerderives them from the method signatures viaParameters<…>rather than taking on a new dependency.Context: the relief is now live
The published Reuters style declared a
reuters-world-terrainDEM source but no layer ever rendered it, so no consumer got relief above zoom 5 — and this story sits at exactlyzoom={5}. Fixed in tr/newsapps_reuters-protomaps#28 and promoted to production, which took the style from 65 to 66 layers.So the docs now distinguish two separate things: 3D terrain (opt-in, only visible when pitched) and shaded relief (flat, always on at z ≥ 5, shipped in the style itself).
Verification
pnpm run check— 0 errors (17 pre-existing warnings in unrelated components)pnpm test— 18 files, 144 tests passpnpm exec eslint— cleanpnpm run build— publint "All good!"pnpm run build:docs— Storybook builds on MapLibre 6.3Expect a Chromatic diff on the Terrain story: it should now show real relief where it previously showed a flat map.