daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. calculate distance
  2. 6371*acos(cos(LatitudeA)*cos(LatitudeB)*cos(longitudeB-longitudeA)+sin(LatitudeA)*sin(latitudeB))
  3.    
  4. $longA     = 2.3458*(M_PI/180); // M_PI is a php constant
  5. $latA     = 48.8608*(M_PI/180);
  6. $longB     = 5.0356*(M_PI/180);
  7. $latB     = 47.3225*(M_PI/180);
  8.  
  9. $subBA       = bcsub ($longB, $longA, 20);
  10. $cosLatA     = cos($latA);
  11. $cosLatB     = cos($latB);
  12. $sinLatA     = sin($latA);
  13. $sinLatB     = sin($latB);
  14.  
  15. $distance = 6371*acos($cosLatA*$cosLatB*cos($subBA)+$sinLatA*$sinLatB);
  16. echo $distance ;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top