I'm trying to calculate the distance between to geographical points, but the calculated distance is bigger than the real one (from Google Maps).
location column in postgresql is define as
geography(Geometry,4326), and the query is:
select ST_Distance(u1.location, u2.location)
For example, I have a pair of points for which the distance is:
- 160 km on Google Maps
- 190 km calculated with the above query.
What can be wrong? I may be missing a projection matter.
I have also tried the following query, but I get the same results:
select ST_Distance(ST_GeogFromText(ST_AsText(u1.location)), ST_GeogFromText(ST_AsText(u2.location)))