Mapbox-gl-js: Circle Layer disappears after certain zoom level

Created on 7 Jul 2017  Â·  7Comments  Â·  Source: mapbox/mapbox-gl-js

mapbox-gl-js version: 0.38.0

Steps to Trigger Behavior

  1. Add a circle Layer
  2. Zoom-in (a lot) in the circle

I made this fiddle where you can reproduce it: http://jsfiddle.net/0mv5nhkv/

Expected Behavior

The circle remains at all zoom levels

Actual Behavior

The circle disappears after a certain zoom level (it seems after changing from z11 to z12)

bug

Most helpful comment

With data-driven styling, you can make the circle size depend on a value in the vector tile. This means that you could be zoomed in to one location, and a circle in another area of the world would be so big that it covered the current viewport as well. We don't, however, have a way to anticipate those values in all vector tiles, and we don't have a way to compute the maximum permissible value, since it depends on data in the vector tiles.

For this reason, we do not recommend making circles that will be displayed larger than roughly one tile. If you need circles that are bigger than that, please generate the vector geometry (polygons) and use the GeoJSON source, or a vector tile source, to display it.

All 7 comments

This might have been fixed (or at least improved) by #4934, can you check with the master version?

With data-driven styling, you can make the circle size depend on a value in the vector tile. This means that you could be zoomed in to one location, and a circle in another area of the world would be so big that it covered the current viewport as well. We don't, however, have a way to anticipate those values in all vector tiles, and we don't have a way to compute the maximum permissible value, since it depends on data in the vector tiles.

For this reason, we do not recommend making circles that will be displayed larger than roughly one tile. If you need circles that are bigger than that, please generate the vector geometry (polygons) and use the GeoJSON source, or a vector tile source, to display it.

I think I understand what you said @kkaefer.

If you try this fiddle: http://jsfiddle.net/n0Lerf2s/ and uses the buttons (go to zoom 22 and reset zoom) the circle doesn't disappears even at max zoom level (22).

I still haven't tried @mourner 's suggestion, I will do that and come back.

@mourner I have tried with the master version but is still not working.

It could be that this has something to do with the panning of the map.
When only using zoom controls for zooming, the circle is visible for all zoom levels:
http://jsfiddle.net/n0Lerf2s/4/
When panning the map, the issue occurs again.
Using the mousewheel for zooming, there will be most of the time some kind of panning, because you are not pointing over the center of the map with the mouse pointer.

Yeah, I was wrong — the real problem here was described by @kkaefer above. If you zoom in with the circle exactly in the center, it will stay in the current tile, but if you zoom in an area a few tiles away from the center of the circle, it will disappear because relevant tile won't be loaded.

@kkaefer Information like this would be very helpful if immediately added to the documentation because it is highly unexpected behavior! I spent much time making sure my rules were not the issue only to randomly Google to find this answer. Issues like this cause the developer to question whether they are implementing code wrong, only to find that the underlying software actually does not support this behavior.

For this reason, we do not recommend making circles that will be displayed larger than roughly one tile. If you need circles that are bigger than that, please generate the vector geometry (polygons) and use the GeoJSON source, or a vector tile source, to display it.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

aendrew picture aendrew  Â·  3Comments

stevage picture stevage  Â·  3Comments

jfirebaugh picture jfirebaugh  Â·  3Comments

mollymerp picture mollymerp  Â·  3Comments

foundryspatial-duncan picture foundryspatial-duncan  Â·  3Comments