I'm trying to figure out what gives me the most accurate distance between positions:

  • Measuring distance directly (using Geod.inv)?
  • Measuring distance in 2D (after transforming to a known projected coordinate reference system)?

I'm trying to project latitude/longitude positions to 2D because it is easier to work with them that way, I'm trying to work with centimeter accuracy.

As a sanity check I did some tests to check if distance between positions were preserved.

Here is an interesting data point (note: I'm actually using DotSpatial library but I re-did this example in pyproj because it is a better-known tool):

Measuring distance "directly" (using geod.inv):

>>> from pyproj import Geod
>>> wgs84_geod = Geod(ellps='WGS84')
>>> lat1, lon1 = (27.23150120120691, -91.522575364888709) # somewhere in the gulf of mexico
>>> lat2, lon2 = (27.239416154284083, -91.520817319790083) # near lat1, lon1
>>> az12,az21,dist = wgs84_geod.inv(lon1,lat1,lon2,lat2)
>>> dist

Measuring distance in 2D (after projecting):

>>> from pyproj import Proj
>>> wgs84 = Proj('+proj=longlat +datum=WGS84 +no_defs') # http://epsg.io/4326
>>> nad27Blm15n = Proj('+proj=tmerc +lat_0=0 +lon_0=-93 +k=0.9996 +x_0=500000.001016002 +y_0=0 +datum=NAD27 +no_defs') # http://epsg.io/32065 but in meters
>>> from pyproj import transform
>>> p1_projected = transform(wgs84, nad27Blm15n, lon1, lat1)
>>> p2_projected = transform(wgs84, nad27Blm15n, lon2, lat2)
>>> p1_projected
(646301.4612381, 3012741.116573205)
>>> p2_projected
(646465.2249033558, 3013620.015186602)
>>> import math
>>> math.sqrt((p1_projected[0] - p2_projected[0])**2 + (p1_projected[1] - p2_projected[1])**2)

So, I'm getting 894.1531771043997 and 894.0253411891856 respectively which have about 0.128 meters difference.

Which one is the most correct distance? Why?

(note: I also have examples where the differences are > 1m, but only when the distances are > 2km).

1 Answer 1


All projections change the distances, projections can preserve angles or areas only. If the distortion caused by the projection is less then 10 cm/km considered a very good projection. The real distance is very hypothetical, if you measure the slope distance between two points the slope distance will be reduced to the horizontal plane, then to the see level and finally to the projection plane to display on the map. So we have slope distance, horizontal distance, see level distance and distance on the projection plane. Which would you call 'most correct'?

geod.inv gives the see level distance, the sqrt(..) gives the distance on the projection plane. The longer the distance, the longer the difference.

  • But there is a real distance in the "real-world". I understand that for very long distances the projection cannot be correct because it does not account for the earth curvature, but for these shorter distances (at most 1KM) what should be my reference point? Jan 12, 2016 at 15:02
  • It depends on the situation and the magnitude of area of interest . If you are planning a monitoring system for a small area (few km) and high precision is needed, you should avoid projections, substitute the Earth with a plan and reduce distances to horizontal only.
    – Zoltan
    Jan 12, 2016 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.