mapbox / mapbox/mapbox-gl-js

Enable `symbol-sort-key` when text/icons on a layer have opposing overlap rules

Open
#9,368 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature :green_apple:
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.

---

Screen Shot 2020-03-02 at 11 05 49 PM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.