I'm getting an unexpected value from a PostGIS distance query, and I'm not sure why. I'm trying to find the distance between two points on Earth.
SELECT ST_Distance(
ST_Point(50.7678,6.091499)::geography,
ST_Point(52.525592,13.369545)::geography
) as distance;
... returns 827757.672533206
, or about 827.7km.
However, if I calculate this distance with an open source library I'm using, or using any one of several online calculators, I get 538.6km. Something is obviously amiss.
What am I doing wrong?
The result is correct, the input is not. ST_Point accepts input as (lon,lat)
while you're verifying it as (lat,lon)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With