Skip to main content
replaced http://gis.stackexchange.com/ with https://gis.stackexchange.com/
Source Link

I have compared some distance calculations between geopygeopy 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?

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?

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?

added 83 characters in body
Source Link
Adam Matan
  • 6.9k
  • 7
  • 38
  • 51

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:

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

Geopy Great Circle:

Great Circle (less accurate) using geopy

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

PostGIS ST_Distance_Sphere:

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?

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:

>>> 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

Geopy Great Circle:

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

PostGIS ST_Distance_Sphere:

=> 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?

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?

added 18 characters in body
Source Link
Adam Matan
  • 6.9k
  • 7
  • 38
  • 51

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:

>>> 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

Geopy Great Circle:

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

Does PostGIS have a Vincenty Distance calculation?ST_Distance_Sphere:

=> 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?

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

>>> 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_distance = great_circle(p1, p2).meters
>>> print great_circle_distance
75.6324224394

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:

>>> 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

Geopy Great Circle:

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

PostGIS ST_Distance_Sphere:

=> 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?

edited title
Link
underdark
  • 84.5k
  • 22
  • 233
  • 415
Loading
added 18 characters in body
Source Link
Adam Matan
  • 6.9k
  • 7
  • 38
  • 51
Loading
Source Link
Adam Matan
  • 6.9k
  • 7
  • 38
  • 51
Loading