You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a MvtLayer with a lot of datapoints which only makes sense to render starting from a specific zoom level. So I used the minZoom setting of the MvtLayer.
Also the datapoints are all located in a single country. I wanted to stop tile requests for areas, that are outside of this country. For that I tried to add the "extent" property.
The combination of these two properties showed some unexpected behavior. For example my inittial zoom level is 5, minZoom of the layer is 10. As soon as I add the extent property, the layer starts to show already on zoom level 5. But it is not using the tile size for zoom level 5. It actually used the tile size that would be used on zoom level 10. That means it fires a lot of requests against the vector tile API.
Flavors
Script tag
React
Python/Jupyter notebook
MapboxOverlay
GoogleMapsOverlay
CartoLayer
ArcGIS
Expected Behavior
minZomm and extent on a MvtLayer can be used in combination. vector tile requests are limuted to the box configured with the extent property. Tile requests and rendering starts not before the minZoom level is reached.
When underzoomed (i.e. zoom < minZoom), the layer will not display any tiles unless extent is defined, to avoid issuing too many tile requests.
There is a legitimate use case where the user still wants to show a tiled layer when zoom < minZoom. In your case, the easiest solution is to set visible prop explicitly based on the current zoom.
According to the implementation, minZoom and extent are settings to control WHICH tiles are requested, not WHETHER to request them. I agree that it may not be apparent by looking at the prop names and the current documentation. I'm open to suggestions.
Description
I have a MvtLayer with a lot of datapoints which only makes sense to render starting from a specific zoom level. So I used the minZoom setting of the MvtLayer.
Also the datapoints are all located in a single country. I wanted to stop tile requests for areas, that are outside of this country. For that I tried to add the "extent" property.
The combination of these two properties showed some unexpected behavior. For example my inittial zoom level is 5, minZoom of the layer is 10. As soon as I add the extent property, the layer starts to show already on zoom level 5. But it is not using the tile size for zoom level 5. It actually used the tile size that would be used on zoom level 10. That means it fires a lot of requests against the vector tile API.
Flavors
Expected Behavior
minZomm and extent on a MvtLayer can be used in combination. vector tile requests are limuted to the box configured with the extent property. Tile requests and rendering starts not before the minZoom level is reached.
Steps to Reproduce
I prepared a CodeSandbox for this. The only thing that needs to be added would be a Mapbox token to make the example runnable: https://codesandbox.io/p/sandbox/vigilant-merkle-pd82h2
And the extent property needs to be uncommented.
Environment
Logs
No response
The text was updated successfully, but these errors were encountered: