mapbox / mapbox/mapbox-gl-js

Non-rendered, "optional" text labels preventing icons being drawn.

Open
#8,327 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

mapbox-gl-js version: 1.0.0

browser: Firefox

Steps to Trigger Behavior

So I have these layers defined like this:

    map.U.addCircle('sites-circles', 'sites', {
        circleColor: 'black'
    });
    
    map.U.addSymbol('sites-pins', 'sites', {
        iconImage: 'marker',
        iconSize: 0.5,
        iconOffset:[0,-30],
        textField: '{Name}',
        textOffset:[0,1],
        textOptional: true,
        textSize: 14,
        textColor: 'hsl(331, 50%, 50%)',
        textOpacity: { stops: [[12.5, 0], [13, 1]] }
    });
Screen Shot 2019-06-07 at 6 32 05 pm

What's really strange is a couple of those circles that don't have pins drawn (eg at the very top right and very bottom right).

If I change textField to '', more pins are drawn:

Screen Shot 2019-06-07 at 6 32 17 pm

This seems really strange to me. For starters, the text labels are supposedly "optional", so why are they blocking the icons from being drawn? Also, at this zoom level, they aren't even being drawn (my understanding was that opacity: 0 was understood specially by mapbox-gl to mean, to not render at all).

Is there a better way to say "don't draw labels below this zoom level"?

Link to Demonstration

http://emscycletours.site44.com/gkn-bug/

Expected Behavior

The situation in the first screenshot should look like the second screenshot.

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 reproducing the linked demonstration in Firefox with the shown addSymbol configuration, then compare textOptional: true against textField: '' across the reported zoom levels. Investigate symbol placement and the textOpacity stops to determine why labels that are not rendered still block icons. Done means the first screenshot matches the expected icon placement or the behavior is clearly documented.

Written by the indexing model from the issue text.

Assessment

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