Icon on Symbol layer doesn't rotate when using icon-pitch-alignment: viewport with icon-rotation-alignment: map
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 3.7.0
**browser**: Google Chrome
### Steps to Trigger Behavior
1. Add a symbol layer to map with an icon image
2. Set both icon-pitch-alignment: viewport and icon-rotation-alignment: map
3. Rotate and pitch the map.
### Link to Demonstration
https://codepen.io/dlbs0/pen/YzmrWyq
### Expected Behavior
The icon rotation stays in sync with the map (ie. always pointing north). The icon isn't transformed/compressed to 'fit' the pitch.
### Actual Behavior
The icon rotation aligns with the map, until any pitch > 0 is introduced, at which point it seems to rotate to ~90 degrees, until pitch is returned to 0. Interestingly, the 'random' rotation (magnitude and direction) seems to be based on the latitude of the center of the map.
### Use Case
My use case for this is displaying a location arrow on the map (replay of user paths). The arrow shows recorded bearing information, so needs to point to the correct heading. I'm currently only using the ```icon-rotation-alignment: map``` setting, which gives me the expected behaviour, but at high 'cinematic' pitches it can be hard to see as it gets transformed.
The docs don't have any notes about this behaviour as far as I can tell: https://docs.mapbox.com/style-spec/reference/layers/#layout-symbol-icon-pitch-alignment
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 running the linked CodePen in Chrome with icon-pitch-alignment set to viewport and icon-rotation-alignment set to map, then inspect the symbol-layer handling for those properties. Done means the icon remains correctly aligned with the map while the map is rotated and pitched, without unexpected rotation or compression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100