mapbox / mapbox/mapbox-gl-js

Optionally allow line-placed labels to cross tile edges

Open
#1,995 2 comments 0 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

For label layers with `symbol-placement: line`, the `avoid-edges` option doesn't do anything (from what I can tell). The symbol will always avoid edges regardless of the setting.

Having `avoid-edges: true` is the right setting for line-placed symbols most of the time, but there are cases where you'd want it off. It's possible to use buffers and geometry clipping to construct layer where each tile a line touches has an identical copy. The `marine_label` layer in Mapbox Streets is an example of this.

As long as the layer ordering is correct, it's safe to allow line labels to cross tile boundaries in this situation. (And the geometries in the `marine_label` layer are isolated enough that even incorrect ordering is pretty forgiving.) In Mapbox Studio Classic styles this approach allowed us to avoid awkward repeated line labels in neighboring tiles. It would be great to have this option in GL as well.

cc @ansis @nickidlugash

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 how line-placed labels handle the avoid-edges option and tile-boundary clipping in the map rendering path. Reproduce the marine_label-style case with buffered, clipped geometries, then verify that disabling avoid-edges permits labels to cross tile boundaries while the default behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, 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.