Joined: 15 Aug 2000
|Posted: Sat Jan 11, 2003 4:05 am Post subject: Finding Distance (in miles) between two points
|Just a little bit of code that can be run from within a vds app to find the approx distance between two points assuming you know the latitude and longitude of each point.
REM %%lat1 & %%long1 is the latitude and longitude of point A and
rem %%lat2 & %%long2 is the latitude and longitude of point B.
%A = @fmul(@fsub(%%lat2,%%lat1),69.1)
%B = @fmul(@fsub(%%long2,%%long1),53)
%%miles = @fsqt(@fadd(@fmul(%A,%A),@fmul(%B,%B)))
%%miles = @format(%%miles,4.1)
This will give you a fairly good estimate of actual miles. Not good enough
for NASA but good enough for other applications. The alternative is using
the Great Circle Formula. It requires figuring arc cosines which is not available in vds.
I actually ran numbers with both formulas and only showed a .2 mile difference.