4

I would like to approximate the distance of a line segment from a reference point on the map (coordinates are gives as lat/lon).

In the Cartesian coordinate system I would simply find the closest point of the line segment to the reference point using the dot product and calculate the distance.

I am new to working with geo-coordinates, and from what I have learnt, segments are called great circles on the Earth's surface. This site gives a clear formula for calculating what I would like (which is I think called the cross-track distance). However it seems an overkill for what I want to do. Firstly, I am interested in shorter distances only, maximum a few hundred kilometers (say 700 km). Second, I can do with an approximate value (say maximum 2-3% error). Third, I want the calculation as quick as possible, and the exact formula contains around 20 trig calculations.

I would need something similar to equirectangular approximation:

x = (lon2-lon1) * cos((lat1+lat2)/2)
y = lat2-lat1 
d = sqrt(x*x + y*y) * R

Is there a way to generalize the above formula for point-segment distances? Or, alternatively, is there a handy approximation to find out the distance of a point and a great circle for small-to-mid distances with reasonable accuracy?

Martin F
  • 8,948
  • 36
  • 58
BKE
  • 141
  • 1
  • 3
  • 2
    A solution that involves only five trig functions and is accurate to about 0.3% or better is given at http://gis.stackexchange.com/questions/81845/how-to-compute-distance-between-4500-points-fast/81879#81879. An approximation involving only two trig functions is given at http://gis.stackexchange.com/a/30037/664. – whuber Jan 27 '14 at 16:38
  • 2
    Welcome to GIS.SE. Dare i say, one of the best-prepared questions from a newcomer. – Martin F Jan 27 '14 at 17:00
  • @whuber: thanks, I get it. I think I'll go with the second approach, ie. map the points to the Euclidean plane using the displacements given in your answer. – BKE Jan 28 '14 at 09:52
  • @whuber, maybe I am missing something, but boths answers linked answer close, but not the same question. Here is the actual answer with pretty pictures: http://stackoverflow.com/questions/32771458/distance-from-lat-lng-point-to-minor-arc-segment – greenoldman Mar 04 '17 at 18:28

0 Answers0