mapbox / mapbox/mapbox-gl-js

Lack of documentation on how mapbox-gl merges lines for label placement purposes

Open
#10,729 0 comments 0 reactions 1 assignee View on GitHub

@mourner is already working on this.

Since Jul 9, 2021.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

We've come across an issue where gl-js seems to (from our perspective erroneously) merge lines before placing labels. This results in labels for feature A being placed along feature B, given both have `symbol-placement: line` and identical `text-field` values.

The screenshot below illustrates the situation. The label on the left belongs to the feature on the right (color is being set via `feature-state`, using the features' `id`s). The two linestrings meet exactly at the point where the building in the middle is placed:

![image](https://user-images.githubusercontent.com/1205180/120322525-c944e680-c2e4-11eb-96ed-101c68808b3b.png)

I have found [this comment](https://github.com/mapbox/mapbox-gl-js/issues/3645#issuecomment-262414642) which seems to indicate the heuristic for merging is based on data-driven properties(?) but I've failed to find any further documentation on how exactly this works.

**mapbox-gl-js version**: `1.13.0`

**browser**: Chrome 90.0.4430.212 (macOS 11.1)

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.