Guest User

Untitled

a guest
May 25th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. $R = 6371; // km
  2. $dLat = deg2rad($lat2-$lat1);
  3. $dLon = deg2rad($lon2-$lon1);
  4. $a = sin($dLat/2) * sin($dLat/2) +
  5. cos(deg2rad($lat1)) * cos(deg2rad($lat2)) *
  6. sin($dLon/2) * sin($dLon/2);
  7. $c = 2 * atan2(sqrt($a), sqrt(1-$a));
  8. $d = $R * $c;
  9. return $d;
Add Comment
Please, Sign In to add comment