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

Double size of outer bounds #1

Closed
ximex opened this issue May 10, 2014 · 3 comments
Closed

Double size of outer bounds #1

ximex opened this issue May 10, 2014 · 3 comments

Comments

@ximex
Copy link

ximex commented May 10, 2014

is it right that the outer bounds of the (multi)polygon is the bbox of the current view?
if you zoom out you could see this bounds for short time. maybe double the size of this bound that you didn't see it if you only zoom out one zoom level.

@ebrelsford
Copy link
Owner

Nope, the outer bounds for either is the whole world. You can see this if you zoom out to zoom level 1 or 2.

I suspect what you're seeing is the transition between zoom levels, where Leaflet takes a moment to fill in the area that was not already filled (previous bbox to new bbox). Not sure there's much we can do about that!

@nrenner
Copy link

nrenner commented Apr 27, 2019

The outer bounds with unfilled areas outside, observed while panning and zooming out, are those of the vector renderer. The renderer bounds are limited to the map view plus some buffer, that can be adjusted with the padding option.

With a padding of 1 (size of map view in each direction; default 0.1), the undesired effect is mostly gone:

L.geoJson(data, {
    invert: true,
    renderer: L.svg({ padding: 1 })
}).addTo(map);

By assigning a new renderer instance (since Leaflet 1.0), this doesn't affect other vector layers, see also second SVG Usage example.

@ebrelsford
Copy link
Owner

@nrenner This is a great tip, thank you for it!

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

3 participants