-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
On-the-fly reprojection of tile maps #48
Comments
This is a cool idea -I don't have a ton of perspective on this one (I haven't used the Place API for some time now...maybe @lawasser does?). However why not try making the lower-level functions first and once that stabilizes, think about providing the higher-level API via place. |
Thanks for doing this @darribas, looks great. I've not seen the memfile approach before, but that's a clever way to get the transform applied! I know I'd use the first two suggested functions. Do you know if this already accepts a geodataframe's
So, if a I can take a look at the diff to make this work, but that'd be easier in a PR 😁 |
OK, cool, I've just issued #49 with an initial commit along the lines suggested by @ljwolf. It's tagged as @ljwolf, I've not played extensively with CRS formats, but I did toy around with what you suggest (I had the same idea) and it seems to work. So I'm not sure every single CRS format is accepted, but |
Cool! When we talked previously about it, I was also thinking about the following related things:
|
Assuming the user had a contextily.add_basemap(ax, crs=gdf.crs) I think that's easy enough to not justify a specific case. What do people think? On |
It's certainly quite easy to do. But, still making this special case also avoids the Longer reasoning: the main reason that I might still do it is the following. A lot of people have data in lat/lon, and that is the defacto default for geo data on the web, (interactive) web plotting, geojson, etc (and the WebMercator projection handling almost always happens under the hood in similar applications). So in an 'ideal' workflow, I would say: if people have lat/lon data, and they don't need to do area/distance based calculations, just use the data as is in lat/lon for visualisation (no need to take care of converting it to WebMercator just for plotting). If people project their lat/lon data to a local projected CRS for other reasons than plotting (or they already have such data), then they also need to remember to pass that CRS to the |
Discussion on development for this feature currently moved over to the PR for this #49 |
Closing as implemented in #49 |
One that I've discussed with @jorisvandenbossche offline and now have made some impromptu progress. Currently,
contextily
only supports Web Mercator so, whatever CRS the original data is expressed in, if the user wants to combine them with tile maps, they need to move their data to WM. In some cases, that's OK but, in other contexts, that might be expensive and it might be a lot better to reproject (warp) the tile map.To get started, here's a tentative function that does this:
I'm putting it in this precarious format, rather than as a PR so:
Folks quickly say if this API works
We can discuss where it could go (my first thought is on
tile.py
but haven't thought too much about itFolks can also chip in on how this could be exposed to end-users. For now, this is all I can think of:
warp_tiles
that can be piped withbounds2img
t_crs
argument inadd_basemap
that defaults toEPSG:3857
and adds a warped basemap to a set of providedmatplotlib.Axes
t_crs
argument when initialising and the response is returned in that CRS (maybe @choldgraf has some input on this?).Ideas/suggestions?
The text was updated successfully, but these errors were encountered: