Search code examples
mapbox-gl

Prevent a layer rotation on map rotate in mapbox-gl


Is there anyway to disable layer rotation on map ratation ? I am using a symbol layer with arrow image icon and I don't want them ro ratate with map and stay fixed.


Solution

  • You should set "icon-rotation-alignment" to "map" (it's "auto" by default).

    https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-symbol-icon-rotation-alignment:

    "map": When symbol-placement is set to point, aligns icons east-west. When symbol-placement is set to line or line-center, aligns icon x-axes with the line.