Enable `symbol-sort-key` when text/icons on a layer have opposing overlap rules
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
When `icon-allow-overlap: true` and `text-allow-overlap: false` or vice-versa for a symbol layer, there is no way to sort icons + text consistently with [`symbol-sort-key`](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-symbol-symbol-sort-key).
Sort key determines draw order in the renderer. Features with lower sort keys are drawn and placed first.
- When overlap is enabled, features with higher sort keys can be drawn and placed over previous features, so features with higher sort keys have higher priority.
- When overlap is disabled, features with higher sort keys cannot be placed over previous features because of the way collision detection works. Therefore, during placement, features with _lower_ sort keys have higher priority.
This behavior has always existed in the renderer and it won't be straightforward to change.
---

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the symbol-sort-key style-spec entry and the renderer's placement and collision behavior described in the issue. Determine how opposing icon and text overlap rules should share a consistent ordering, then verify that the behavior is covered for both overlap directions. Done means symbol-sort-key provides predictable priority in these cases without regressing existing placement behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100