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

Add Map.fit_bounds(bounds) #737

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

davidbrochart
Copy link
Member

It is not implemented using Leaflet's fitBounds method (see issues below), but by iteratively changing the zoom level and checking the bounds (which is the maximum bounds of all map views).

Fixes #96
Fixes #529

@davidbrochart davidbrochart merged commit 14131d6 into jupyter-widgets:master Oct 19, 2020
@davidbrochart davidbrochart deleted the fit_bounds branch October 19, 2020 12:51
@astrojuanlu
Copy link
Contributor

Perhaps something like this could be used to avoid the zoom iteration?

https://github.com/satellogic/telluric/blob/72b0d2dd9e5efe65ba11845fc39c94e83d8394a0/telluric/plotting.py#L56-L79

@davidbrochart
Copy link
Member Author

I was thinking about that too, but mercantile is spherical mercator only, and ipyleaflet also supports custom projections.

@astrojuanlu
Copy link
Contributor

I was thinking about that too, but mercantile is spherical mercator only

Fair enough! It's great to see this feature anyway

and ipyleaflet also supports custom projections.

Oh wow, I didn't know that! Reading now some examples in #612 (couldn't find anything in the docs), amazing!

@davidbrochart
Copy link
Member Author

Thanks!
Yeah the docs are always lacking. We mention custom projections in the crs attribute of the map, but it's really hidden 😄
Otherwise there is this notebook: https://github.com/jupyter-widgets/ipyleaflet/blob/master/examples/CustomProjections.ipynb

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

Successfully merging this pull request may close these issues.

Feature request: provide access to Leaflet's fitBounds Add fitBounds method for map
2 participants