mapbox / mapbox/mapbox-gl-js

Implement `max-curvature` property for labels

Open
#4,826 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cross-platform :tv: feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

With https://github.com/mapbox/mapbox-gl-js/pull/4781, labels can now do a good job of following roads with arbitrary geometry. 🙌

However, following a road as long as you can ends up looking pretty weird, especially in the distance, as road labels can start bending back on themselves (see Ocean Park Blvd in the screenshot).

![screenshot 2017-06-12 13 29 42](https://user-images.githubusercontent.com/375121/27053737-37dc75a2-4f73-11e7-92a5-8142f94d292d.png)

We already have [text-max-angle](https://www.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-text-max-angle), but that only controls the maximum curvature of any _single_ angle in the line, so it doesn't prevent a label from flipping back on itself through a series of smaller angles.

Instead of making this a style property, it might also make sense to find a good value to hardwire (maybe something a little less than 180 degrees?).

/cc @nickidlugash @ansis

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 reviewing PR 4781 and the existing text-max-angle style-spec behavior. Determine whether max-curvature should be a style property or a hardwired value, then verify that road labels no longer bend back on themselves through a series of smaller angles.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.