Leaflet / Leaflet.VectorGrid

Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet 1.0.0
601 stars 193 forks source link

Define bounds or extent of VectorGrid layer #256

Closed bowguy closed 3 years ago

bowguy commented 3 years ago

I have a VectorGrid layer working fine in a Leaflet map. The layer only covers one county in the US. When I pan out of the county, it still continues to request tiles even though there is nothing there. I have set up GeoServer to return the tiles outside the bounds, but the map is still making the request adding to bandwidth. Is there a way to define the VectorGrid layer to only retrieve within the specified bounds or extent?

IvanSanchez commented 3 years ago

This is one of those RTFM things.

From https://leaflet.github.io/Leaflet.VectorGrid/vectorgrid-api-docs.html#vectorgrid :

Extends Leaflet's L.GridLayer.

And then, https://leafletjs.com/reference-1.7.1.html#gridlayer-bounds

bowguy commented 3 years ago

Perfect. Thanks for the M links - I'll take care of the RTF part