sortingmapbox-gl-jsz-ordermapbox-studio

Mapbox Studio feature Z-ordering


I would like to order "circle" features in a layer in Mapbox studio. The entire Style, including this layer and other layers, is added to a map using GL.JS, and symbology for the layers are set in studio.

I see the documentation for circle-sort-key for gl-js style specification, but don't see where to set it along side the other properties (raduis, color, opacity, etc) for the layer style in studio.


Solution

  • Since the documentation doesn't give a detailed example, I'm adding my final solution here. Following @steve-bennett's suggestion, to sort the smallest circles on top:

    map.setLayoutProperty('layername','circle-sort-key',["*", -1, ["get", "propertyname"]])