JuliaGeo / GeoFormatTypes.jl

Wrapper types for spatial data formats like well known text, KML, Proj4 strings.
https://juliageo.github.io/GeoFormatTypes.jl/stable
MIT License
6 stars 0 forks source link

Add type parameters for compile-time dispatch on CRS #30

Open rafaqz opened 11 months ago

rafaqz commented 11 months ago

It would be useful to add at least coordinate order XY/YX and Spherical/Cartesian singletons to the CRS type.

This may let us wrap point with e.g. y/x order in the CRS, and dispatch to the correct distance/area methods. Having these in the type means we can use them for low level operations with no overheads.

These parameters could be nothing by default. At whatever point they to be used we could parse the CRS with Proj/ArchGDAL and fill in the parameters, or as the worse case / status quo - assume they are x/y, and just error for area/distance.

It may be that some other object could hold these parameters instead, but it seems like it should be attached to the CRS object to keep things simple.

It may also be useful for users to be able to specify the X/Y order manually because many other tools also do not follow the crs point order.

asinghvi17 commented 2 months ago

Maybe a wrapper type which acts like a "trait holder" could, be useful? Eg GeneralCRSType{AxisOrder, ProjectedOrGeographic, ESRIWellKnownText}. Could even add a Cylindrical trait so people can know to wrap coordinates.