View Single Post
Old 02-08-2016, 10:46 AM
  #2  
bradthepilot
Gets Weekends Off
 
bradthepilot's Avatar
 
Joined APC: Jan 2016
Posts: 417
Default

Use the following (and if you can do it in your head, you're awesome):
Dlon = longitude2 - longitude1
Dlat = lattitude2 - lattitude1
a = (sin(Dlattitude/2))^2 + cos(lattitude1) * cos(lattitude2) * (sin(Dlongitude/2))^2
c = 2 * atan2( sqrt(a), sqrt(1-a) )
d = R * c (where R is the radius of the Earth in appropriate units - result will be same units)

This is from code, so where you see '*' think "multiplied by" or "times".
bradthepilot is offline