MapLibre order fill-layer feature collection render position/z-index

33 Views Asked by At

In my maplibre app I render a feature-collection of polygons and display popups when a specific feature is hovered. As some polygons may overlap others I want to order them based on their size.

Maplibre feature-collection layer

Only thing I've found is the layout property fill-sort-key that I'll assign during layer creation. Although this does not seem to have any effect.

Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.

layer.layout = { "fill-sort-key": ["get", "area"] };

Is this generally possible? Or do I have to draw a layer for each feature?

TLDR; How to order / set a z-index for features in a fill layer. (I want to order them by area size)

0

There are 0 best solutions below