Closed martinfleis closed 2 years ago
I am happy to contribute this as a PR.
I've been planning to open this issue since you announced xyzservices on Twitter :-)
If you have the time for the PR please do send it in our way! It will be an awesome addition to folium.
I came here to see if folium supported xyzservices - and it now does. Thank you.
Is your feature request related to a problem? Please describe.
With the @geopandas team, we have built a new package called
xyzservices
to serve as a unified place for XYZ tile management. The idea behind this is that other packages will depend on that instead of having their own system and list of supported tiles hard-coded. It would be great to havefolium
on board with the idea, by supportingxyzservices.TileProvider
as an input oftiles
.xyzservices
itself does not have any dependencies which makes it a non-problematic dependency.It is worth mentioning that
xyzservices
stores providers' metadata in JSON undershare
, accessible for anyone if you have a use case for that.I am happy to do any changes in
xyzservices
needed to make it as useful for you as possible if that allows centralising maintenance of providers in one place.Describe the solution you'd like
I'd like to see the support of
TileProvider
as an input oftiles
andTileLayer
.All the info
TileLayer
require can be fetched from theTileProvider
object under the hood.Describe alternatives you've considered
You can pass individual attributes manually as we currently do in
xyzservices
docs but it can be streamlined with a built-in support.Additional context
Support of
xyzservices
is being implemented across the ecosystem, from geopandas' own packages (new built-in foilum-based plotting (https://github.com/geopandas/geopandas/pull/1953) andcontextily
) toleafmap
(https://github.com/giswqs/leafmap/issues/91),ipyleaflet
(https://github.com/jupyter-widgets/ipyleaflet/issues/854) and holoviews (https://github.com/holoviz/holoviews/issues/5057) (+ hopefully more).If there's anything we would need to implement in
xyzservices
to make all this work, I am all ears.Implementation
I am happy to contribute this as a PR.
In this case, it is actually quite simple and can be done without importing
xyzservices
asTileProvider
is a subclass of dict. Something along this: