Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icon on Symbol layer doesn't rotate when using icon-pitch-alignment: viewport with icon-rotation-alignment: map #13307

Open
dlbs0 opened this issue Oct 22, 2024 · 0 comments

Comments

@dlbs0
Copy link

dlbs0 commented Oct 22, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant