visgl / visgl/deck.gl

TextLayer Label Collision - Text Allow Overlap Option

Open
#6,417 3 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
14.6k
Forks
2.3k
Avg merge
2d 9h
Merged PRs (30d)
42

Description

Target Use case

It would be great to have an option to selectively hide/show text labels when they overlap/collide. Currently, TextLayer becomes unusable when displaying a large number of text labels (especially as you zoom out) as the labels overlap one another to the point that they cannot be read.

Proposed feature

Ideally, textAllowOverlap/getSortKey props could be added to the TextLayer to mirror the functionality provided by the Mapbox GL SymbolLayer.

The Mapbox GL SymbolLayer has a text-allow-overlap (and icon-allow-overlap) feature that supports enabling/disabling this behavior. The SymbolLayer also accepts a symbol-sort-key attribute to define priority such that labels with a higher sort key will be hidden first when an overlap occurs.

https://docs.mapbox.com/help/troubleshooting/optimize-map-label-placement/#label-collision
https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-symbol-text-allow-overlap
https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-symbol-symbol-sort-key

To Do List
  • Add label and assign to milestone
  • Coding
  • Doc update
  • What’s new update
  • Test

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 locating the TextLayer entry point and its current label rendering behavior, then compare the requested textAllowOverlap and getSortKey behavior with the linked Mapbox SymbolLayer documentation. Done means overlapping labels can be selectively shown or hidden by priority, with accompanying tests, documentation, and a What's New update.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.