contextily icon indicating copy to clipboard operation
contextily copied to clipboard

[ENH]: Arbitrary coordinate systems for tiles?

Open Huite opened this issue 5 years ago • 2 comments

Hello all,

A colleague showed me this via the geopandas docs, and this looks like an extremely neat package!

I do nearly all my work in the Netherlands, so I mostly use EPSG: 28992 (RD New) as my coordinate system. I can still use the contextily basemaps by simply warping my own grids, but there's also a large number of tilesets provided by the Dutch platform for geodata: https://www.pdok.nl/ https://www.pdok.nl/datasets

Many of these tilesets are only available in EPSG: 28992, but so is my data anyway. It would allow to present my data in a 1:1 fashion without any warping or reprojection. Implementing it seems manageable, at least in terms of a prototype:

  • _calculate_zoom currently assumes latitude / longitude
  • mercantile doesn't exist for arbitrary coordinate systems; the functions tiles, xy, bounds are used

I suppose the nice thing about Web Mercator is that you always know the extent: the entire globe. With an arbitrary coordinate system, you first have to fetch some metadata.

Anyway, I've had a cursory walk through the issues, pull requests, and the source code; I don't see any reference to alternative tile coordinate systems, but I figured I'd raise this issue first before I start prototyping something:

  • Is anyone already working on this?
  • Would you have any interest in a pull request in due time, or would you consider it out-of-scope a priori?

My personal use would be pretty parochial, but I'd assume there are many tile services in the world which are provided in a local coordinate system.

Huite avatar Feb 05 '20 17:02 Huite

Hello!

Thanks for the comments and the suggestion! I'm not aware of anyone working on this (I actually hadn't realised you could have a tileset in a different CRS... you live you learn!). I think it'd be an interesting bit of functionality to add to the library, but I'm not sure the core changes would fit in contextily. It seems the heavy lifting would belong in either a "generalised" mercantile, or in a sister library that does a similar thing for tilesets in an arbitrary CRS. If that was available, I think it'd be great to hook that functionality then into contextily. Of course, PRs in this space would be greatly appreciated!

Happy to discuss further on further details, etc.

darribas avatar Feb 06 '20 09:02 darribas

Thanks, that's exactly what I needed to know.

I agree that a "mercantile-sister" would be the obvious spot for the heavy lifting. My schedule's a bit busy at the moment and I still have some figuring out to with regards to the different tile services, but I'll keep you posted if I make some progress.

Huite avatar Feb 06 '20 11:02 Huite