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?