Support pitch top-level interpolate expression
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Motivation
I would like to disable terrain when the camera is pointing down so that the map doesn't deform, specially when showing a raster layer featuring baked-in text. I would like to smoothly transition it in and out with an expression using pitch.
Notice how the pink line is wobbly on the first picture. This is particularly obvious when moving the camera around.
Design Alternatives
There is obviously this rather tedious option:
map.on('pitch', () => {
const pitch = map.getPitch();
const newExaggeration = pitch > 30 ? (pitch / 30) : 1.0;
map.setTerrain({
'source': 'mapbox-dem',
'exaggeration': newExaggeration
});
});
Mock-Up
terrain: {
source: 'mapbox-dem',
exaggeration: ['interpolate', ['linear'], ['pitch'], 0, 0, 20, 1],
},
Concepts
This option would fit nicely with the existing top-level zoom interpolation logic
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 locating the existing top-level zoom interpolation logic mentioned in the issue, then trace how terrain exaggeration is read and applied. Implement the requested pitch-based interpolation for terrain exaggeration and verify that terrain transitions as camera pitch changes without requiring a pitch event handler.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100