I have a large number (hundreds of thousands) of point features uploaded to my account in MapBox studio as a dataset, and have generated a tileset based on that dataset. This tileset is used in a Style as a layer source for a circle layer. I am then using this style as the basis for a slippy map implemented in MapBox GL JS

How do I use one of the properties of the features in my datasource to determine the drawing order of the features in mapbox gl? I can't see any options for that in the style editor. I've tried setting the circle-sort-order layout property


but that did not seem to change anything.

2 Answers 2


In your example you are subtracting undefined from propertytosorton. Not sure about the results.

If you want to sort in ascending order (large values drawn over/after small values) of the property you should:

"layout": {
  "circle-sort-key": ["get", "propertytosorton"]

If you want to sort in descending order (small values drawn over/after large values):

"layout": {
  "circle-sort-key": ["*", -1, ["get", "propertytosorton"]]

Looks like the solution is a combination of the question and previous suggestion. Here is the answer I found:

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

see: https://stackoverflow.com/questions/72708747/mapbox-studio-feature-z-ordering/72739859#72739859

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.