0

Given what I know about how Latitude and Longitude works, metric distances between two points at constant Longitude, but different Latitude, should be different. However, this is not what the Python library Geopy reflects. For example:

from geopy.distance import distance

point_a = (0,0); point_b = (1,0)

point_c = (0,75); point_d = (1,75)

print("a - b ", distance(point_a, point_b).m)
print("c - d ", distance(point_c, point_d).m)

This returns:

>>> a - b 110574.38855779878
>>> c - d 110574.38855779878

I feel like these distances should not be the same, or am I missing something critical about how these distances are calculated? Does the distance function not set the projection to WGS84/4326 by default, but instead use some local projected coordinate system?

Todd
  • 101
  • 1
  • 9

2 Answers2

2

Never mind, I was getting the coordinate order backwards:

from geopy.distance import distance

point_a = (0,0); point_b = (0,1)

point_c = (75,0); point_d = (75,1)

print("a - b ", distance(point_a, point_b).m)
print("c - d ", distance(point_c, point_d).m)

Now this returns what I would expect...

a - b  111319.49079327357
c - d  28901.663548048124

I feel like we all just need to agree that all coordinate order should be (x,y). (Lat, Lon) is outdated and never used in analysis.

Todd
  • 101
  • 1
  • 9
0

Yup, according to the docs, geopy defaults to geodesic distance, but has capabilities for WGS84 as well.

Geopy can calculate geodesic distance between two points using the geodesic distance or the great-circle distance, with a default of the geodesic distance available as the function

maltodextrin
  • 152
  • 4
  • Good to know, thanks. I really just derped the inputs and wasn't actually measuring points at different latitudes (see my answer below). :D – Todd Jul 31 '19 at 16:34
  • Geodesic (ellipsoid) and great-circle (sphere approximation, off by at most ~0.5%) distances are very similar, and would be either same or different in this test (but very slightly different from each other). – Michael Entin Aug 01 '19 at 02:51