Mapbox-gl-js: Line disappears when zooming closer than 18th zoom level

Created on 18 Aug 2017  Â·  8Comments  Â·  Source: mapbox/mapbox-gl-js

mapbox-gl-js version: 0.39.1

Steps to Trigger Behavior

  1. Open JSBin Example
  2. Set accessToken variable to your token
  3. Zoom in and see the grey line disappear

Expected Behavior

Line should be visible

Actual Behavior

Line disappears

P.S. Looks like duplicated points with a different floating point precision is the root of the issue

bug

All 8 comments

Yeah, that looks like some kind of bug. Meanwhile, as a workaround, you can set maxzoom: 24 in the source config — this seems to fix the issue.

Hey there !

I wanted to add some informations about this bug.

When drawing a LineString, no matter how many points there are, if the last two are duplicated, the line before those point will disappear when reaching the 18th zoom level.
For example, if we draw a LineString between A, B and B, the line between A and B will disappear, and I think it shouldn't.

Though I noticed some things :

  • That behavior happens when there's at least 3 digits after the decimal point on the coordinates numbers.
    When there's less than 3 digits after the decimal point, only a part of the line disappears, near the second duplicated point.

  • That behavior does not occur if the duplicated points are not the last two.

  • Even though the previous line disappears, there is apparently a bit of a line drawn. I guess it's the one between the two last points.

I made a JSFiddle as an example, there is two lines, one with three points, where the last two are duplicated, and another line with three point, where the first two are duplicated.
here it is :
https://jsfiddle.net//9f5t5jcp/2/

Thank you in advance for your answer, keep up the good work !

Is there any update on this issue? Running into this as well. Can confirm @CombesA 's bug is occurring for me as well. (Last two points are duplicated = only a piece of the line gets drawn after zoom level 18)
Was not fixed by setting maxZoom for map to 24.

I am setting minzoom on the source config and this still doesn't seem to work. If vector tiles are generated through zoom 11, they always disappear when I hit 12. This did not use to be the case...

I'm experiencing the same issue and I couldn't fix it by setting maxzoom for the source to 24, also removing duplicate points didn't help. In our case the issue was fixed by reducing the amount of decimals of the coordinates.

We're seeing this as well. Linestrings become very distorted at high zoom levels.

EDIT: 64 bit rendering solved most of the issues. Still minor clipping.

Hi, Is there any update on this issue? I would like to be able to zoom in further and still see all polygon lines. Thanks.

Edit: I came up with a work around for this. Instead of drawing a single line, draw a polygon where the last segment of the polygon lays exactly on top of the first segment. The last segment will not display due to the Mapbox GL Js bug. However, the first segment will still display and the polygon will look complete to the user.

Fix for the issue coming in #9218. Apologies for addressing this so late! And thanks a lot to @CombesA for such a clear test case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aderaaij picture aderaaij  Â·  3Comments

jfirebaugh picture jfirebaugh  Â·  3Comments

rigoneri picture rigoneri  Â·  3Comments

stevage picture stevage  Â·  3Comments

muesliq picture muesliq  Â·  3Comments