Closed keltia closed 8 months ago
Hi! Thanks for reporting this issue!
The _spheroid functions expect WGS84/EPSG:4326 which mandates a latitude/longitude axis order, not a longitude/latitude axis order, which is why you are getting wrong result. Admittedly this is somewhat confusing and made worse by the fact that DuckDB spatial is in the minority of trying to remain ambivalent and respect the axis order mandated by the projection compared to most other GIS tools that always do lon/lat. This will probably change on our end in the future.
Thanks for the answer. This also points to a bigger issue, there is no documentation whatsoever on these functions... 😅 I sent a comment on the now-closed PR #74 before 0.10.0.
Much better, thanks!
Running `C:\Users\roberto\Src\rs\src\fetiche-rs\target\debug\examples\dist.exe 49.616426 6.174652 49.6300506592 6.2211528048`
Distance between
Point(Coord { x: 6.174652, y: 49.616426 })
and
Point(Coord { x: 6.2211528048, y: 49.6300506592 })
Distances:
3676.33 m haversines
3676.33 m (sin/cos)
3685.81 m geo::geodesic
3676.29 m geo::haversines
3685.81 m geo::vincenty
3685.81 m duckdb:speh
I have a Rust program to calculate geodesic distances with both my implementations and the geo crate. Distances are pretty similar but as soon as I use ST_Distance_Spheroid(), I get wildly different results.
Code is at: https://github.com/keltia/fetiche-rs/blob/develop/process-data/examples/dist.rs
Results are:
Did I miss something? The functions are still undocumented so I don't know.
The query is basic: