JuliaGeo / Proj.jl

Julia wrapper for the PROJ cartographic projections library
MIT License
48 stars 9 forks source link

add geointerface reprojection #79

Closed rafaqz closed 1 year ago

rafaqz commented 1 year ago

This PR adds some basic GeoInterface.jl compatability for the Coords object, and uses that to add a reproject method that can reproject any geointerface geometry between source and target crs.

reconstruct could be moved to GeoInterface as it's quite generic - it rebuilds any nested geometry from a vector of points using wrapper types that match the original structure. Currently it's not type stable.

One issue is that GeoInterface.ncoord doesn't work on Coords - currently it returns 4 because its an array with x y z and timestamp, but there is no way we can detect if it is 2 or 3.

We may have to settle for ncoord always being 3, and changing how the GeoInterface wrappers check point objects - we can let them have extra coords and use the wrapper to clamp them to hide the z. Currently the wrapper Point checks the number of coords in the wrapped objects and errors if it doesn't match.

Another option is to add a type parameter to Coord to indicate if it is 2 or 3 dimensional.

rafaqz commented 1 year ago

@visr @evetion I think this is good to go, if you would like to review.

The idea was to use syntax close to ArchGDAL.reproject but to also update it for keywords to match this PR.

We could also define trans(geom) to work in a similar way if that makes sense for Transformations?

rafaqz commented 1 year ago

Closed in favour of putting this in GeometryOps.jl