rafaqz / Extents.jl

A shared Extent object for Julia spatial data, with DE-9IM spatial predicates
MIT License
4 stars 3 forks source link

Extents.extent should overload GeoInterface.extent #7

Closed felixcremer closed 1 year ago

felixcremer commented 1 year ago

I find it surprising, that for two packages that are so closely related, there are two functions with the same name, which have the same aim, but different dispatches.

I ran into this, because I used Extents to explicitely define a bounding box and I used GeoInterface to get the extent of a geometry from a shapefile.

rafaqz commented 1 year ago

Yeah, it kinda sucks. GeoInterface would have to depend on Extents.extent.

But we do need GeoInterface.extent as a separate thing because it will build the extent from a geometry if its not known, and Extents.jl cant do that because it doesn't know about geometries. But all the geometry packages should all define Extents.extent and GeoInterface.extent should call that.

@evetion what do you think

(I have been waiting to see how much people complained about this :sweat_smile: )

rafaqz commented 1 year ago

This has been resolved the other way - GeoInterface.extent is still a separate method, but now falls back to calling Extents.extent.

The main difference now is that GeoInterface.extent will by default calculate the extent if none exists. Extents will just return nothing.

Probabaly we need to migrate a bunch of geometry packages to use Extents.extent for this change to be widely useful.

https://github.com/JuliaGeo/GeoInterface.jl/pull/94