forum.vdsworld.com

Author Message
nick
Contributor

Joined: 15 Aug 2000
Posts: 50
Location: hamburg,nj

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.

 Code: 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.

Nick
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT Page 1 of 1