spherely icon indicating copy to clipboard operation
spherely copied to clipboard

Implement the __geo_interface__ on Geography objects

Open jorisvandenbossche opened this issue 1 year ago • 4 comments

See https://gist.github.com/sgillies/2217756

Of course, given this is GeoJSON-like, there might be confusion about the edges not being planar for spherely. But for general interoperability I think it would still be good to implement.

jorisvandenbossche avatar Oct 30 '24 11:10 jorisvandenbossche

I've been looking into this and opened https://github.com/paleolimbot/s2geography/issues/56 as I think that the easiest way to support __geo_interface__ (as well as coordinate getters like in #23) is via a customizable formatter class in s2geography. We would also get support for tessellation & projection for free.

Of course, given this is GeoJSON-like, there might be confusion about the edges not being planar for spherely.

This is where it will be useful to have options like planar=True, tessellate_tol, etc. exposed globally (or via a context manager) in spherely, since AFAIK __geo_interface__ has no option.

benbovy avatar Dec 06 '24 12:12 benbovy

This is where it will be useful to have options like planar=True, tessellate_tol, etc. exposed globally (or via a context manager) in spherely, since AFAIK __geo_interface__ has no option.

I am not entirely sure if I would like to have planar as a global option though .. For the explicit import/export functions, that feels like something that should always be specified at the point of import/export.

jorisvandenbossche avatar Dec 07 '24 14:12 jorisvandenbossche

Agreed a planar global option might be dangerous. We could still expose a narrow-scoped option like geo_interface_planar=True to work around the impossibility to specify such option as export argument in this case.

benbovy avatar Dec 09 '24 08:12 benbovy

bigquery's documentation mentions that for loading GeoJSON it uses something similar to planar=True and tessellate_tolerance=10.0. I haven't seen anything yet about exporting to GeoJSON, but I guess we could use similar (default) settings for the geo interface.

benbovy avatar Dec 11 '24 13:12 benbovy