maplibre-style-spec icon indicating copy to clipboard operation
maplibre-style-spec copied to clipboard

Collision groups

Open westnordost opened this issue 1 year ago • 3 comments

User Story

I want to have name labels not collide with pins. At the same time, both the pins and the labels should of course each in their own layer collide among themselves so that pins don't overlap with other pins and name labels don't overlap with other labels.

Rationale

I've got a map dotted with a lot pins. In fact, there are so many pins that not all should be displayed, which is why the layer that shows the pins defines "icon-allow-overlap": false. (The dots you see in the screenshot are a different layer with the same data that allows overlapping in order to achieve the effect that hidden pins are at least displayed as little dots.)

You see in the above screenshot that road name labels are only displayed where there are no pins.

The method I know from tangram to solve this use case would be collision groups: Each layer can specify a bitmask of collision groups it should be part of, so the user can freely define which layer's elements collide with which other layer's elements. Such a symbol-collision-groups layout property could for example be defined by a bitmask (e.g. 0b110) or an array of named groups (e.g. ["labels", "pins"])

westnordost avatar Sep 18 '24 07:09 westnordost

I tend to think this issue should be moved to the style spec repo for discussion as this is a general style spec requirement, right?

HarelM avatar Sep 19 '24 05:09 HarelM

Yes, I wasn't aware of that repo, sorry.

Am 19. September 2024 07:41:48 MESZ schrieb Harel M @.***>:

I tend to think this issue should be moved to the style spec repo for discussion as this is a general style spec requirement, right?

-- Reply to this email directly or view it on GitHub: https://github.com/maplibre/maplibre-style-spec/issues/822 You are receiving this because you authored the thread.

Message ID: @.***>

westnordost avatar Sep 19 '24 05:09 westnordost

@westnordost I like the idea. Anything touching collision sounds quite complicated to implement though. We tend to only adopt something in the style spec if there's a good chance it will actually be implemented in one of the renderers.

If you still want this functionality I can bring this up during the next TSC Meeting.

louwers avatar Apr 14 '25 09:04 louwers