Skip to main content
6 of 6
replaced http://gis.stackexchange.com/ with https://gis.stackexchange.com/

Does PostGIS have a Vincenty Distance calculation?

I have compared some distance calculations between geopy and PostGIS ST_Distance_Sphere, and it seems that PostGIS ST_Distance uses a calculation that is similar to the great circle distance rather than Vincenty.

Geopy Vincenty (Most accurate) using geopy

>>> from geopy.distance import great_circle, vincenty
>>> p1=(32.083659,34.806480)
>>> p2=(32.0843373,34.8065365)
>>> vincenty_distance = vincenty(p1, p2).meters
>>> print vincenty_distance
75.4044140365

Great Circle (less accurate) using geopy

>>> great_circle_distance = great_circle(p1, p2).meters
>>> print great_circle_distance
75.6324224394

PostGIS ST_Distance_Sphere, Unknown Algorithm:

=> SELECT ST_Distance_Sphere(
          ST_SetSRID(ST_MakePoint(34.806480, 32.083659), 4326),
          ST_SetSRID(ST_MakePoint(34.8065365, 32.0843373), 4326));
 st_distance_sphere
--------------------
       75.611223453
(1 row)

Does PostGIS have a Vincenty Distance calculation?

Adam Matan
  • 6.9k
  • 7
  • 38
  • 51