-
-
Notifications
You must be signed in to change notification settings - Fork 84
Centralise XYZ services? #153
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
Comments
cc @martinRenou |
Indeed, thanks for pointing that out. |
I love the idea. Thanks for bringing that up.
What's really nice about the |
When I wrote the new providers module in contextily, it was actually inspired on ipyleaflet (I know I had the same thought about potentially sharing this as well, but forgot to open an issue about it back then, thanks Dani!). So if you look at the providers code in contextily (https://github.com/geopandas/contextily/blob/master/contextily/_providers.py), you will see it also uses a "Bunch". Which is basically the same as the one of traitlets, but hardcoded (so indeed adding attribute access to the dictionary, and in addition I also added contextily/contextily/_providers.py Lines 16 to 38 in 0d1413e
|
Nice. It would definitely make sense to share this. |
Nice! What would be a good approach? A few questions to think through:
Does this sound sensible? Maybe let's flesh out more details on this issue so, when somebody has bandwith, it's easy to pick up coding? |
I guess a good approach would be to look at what you need for each element of the bunch in geopandas, look at what we need in ipyleaflet, and merge the results. What we need in ipyleaflet is:
Also some urls contain a
I feel like there is a bit more in contextily, but again merging both would be the best approach I guess. |
All those listed keys are available in the providers defined here in contextily (again, the dict structure is actually based on ipyleaflet ;), and all values are obtained from scraping leaflet-providers https://github.com/leaflet-extras/leaflet-providers). One potential problem is the attribution: in contextily we stripped them from all html code (https://github.com/geopandas/contextily/blob/master/scripts/parse_leaflet_providers.py#L121), while keeping this probably makes sense for ipyleaflet. For the date, this is done with a So if ipyleaflet would happy to use this, I think it would basically entail:
|
Yes, in any case we can update our code it there is any change in how we insert the date.
Let's get started with this. |
This is great! I'm not sure when exactly I'll have bandwidth to get started on this (summer fast approaching?), but if anyone can, please do go ahead. In the meantime, it might help discussing a few things (aka a few random thoughts about going forward):
|
I think hosting it in |
It looks like we are all too busy to work on this. Should we drop the idea or keep it open? We'd like to move forward with jupyter-widgets/ipyleaflet#741. |
Hello, thanks for the post and checking in. I'm very low on bandwith atm (term time in corona days does not leave much coding time...) and would not want to delay any progress on your end. If any of those ideas could be developed outside ipyleaflet so we can consume in other libs like In reading #741 it occurred to me that a start to centralise basemaps could be a JSON file that could be imported on I'm sorry I can't commit to more right now, I'm just over-stretched. |
No worries @darribas! |
A quick update on this. @darribas and I plan to do a coding sprint on this by the end of the next month, starting from the current One thing I'd like to understand before that is the best way of storing the basemap metadata. At the moment, we have them hard-coded in a (generated) contextily/contextily/_providers.py Lines 41 to 48 in 799c708
However, reading through jupyter-widgets/ipyleaflet#741 and the discussion above, one option which came to my mind is to store them as JSON and create the Also, if there are some updates in ipyleaflet or elsewhere that should be taken into the account, let us know. |
That would be great. |
One idea brought by @SylvainCorlay in jupyter-widgets/ipyleaflet#741 was that we could install this JSON file under To answer to your question in this issue @jorisvandenbossche:
It's something that this |
I like this idea (not that I know how to do that atm). To use the JSON you just need to ensure that |
The work on the package has begun at https://github.com/geopandas/xyzservices. Please express any wishes we did not cover yet (either in code or in issue) as an issue in the repo. At the moment, we store providers in JSON and mimic the behaviour of |
We're moving to the next phase with this. During the following days, I'll try to open issues in respective packages to start a discussion on how to use it in the most efficient way. Thanks a lot for this discussion - now let's move it to https://github.com/geopandas/xyzservices. 🎉 |
Playing with
xarray-leaflet
I realisedipyleaflet
supports a similar set of providers than us and seems to hand-code the providers in a similar way to how we do it:https://github.com/jupyter-widgets/ipyleaflet/blob/master/ipyleaflet/basemaps.py
This has got me thinking if there's scope to join forces into a small library (
xyzervices
?) that parses a large amount of XYZ providers in a way that is useful to the Python data community. From the looks of it, other libraries could also use it and we'd only need to edit providers in one place for everyone to benefit.Would this make sense? @jorisvandenbossche, @SylvainCorlay, @davidbrochart
The text was updated successfully, but these errors were encountered: