Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Properties "extent" and "minZoom" on a MvtLayer can not be used together #8695

Open
1 of 7 tasks
wahler opened this issue Mar 22, 2024 · 1 comment
Open
1 of 7 tasks

Comments

@wahler
Copy link

wahler commented Mar 22, 2024

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

  • 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.

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

  • Framework version: 8.9.35
  • Browser: Chrome v123
  • OS: macOS 14.4

Logs

No response

@wahler wahler added the bug label Mar 22, 2024
@Pessimistress
Copy link
Collaborator

This behavior is explained in the documentation (though maybe not very clearly):

https://deck.gl/docs/api-reference/geo-layers/tile-layer#minzoom

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.

@Pessimistress Pessimistress removed the bug label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants