Tuesday, June 20, 2017

Great-Circle Distance between two lat long positions

This formula doesn't count the flattening of the earth at the poles. 
The earth has been approximated to a sphere with a radius of 6378 km.
 


function Great_circle_distance(latA,longA,latB,longB) =   
acos ( 
sin (latA) * sin (latB) +
cos (latA) * cos (latB) * cos (longB - longA) 
)*111.195  ;//(6371/57.295779513)

echo (Great_circle_distance(48.8566, -2.3522,52.5200 , -13.4050) );
//INFERNAL ;)
echo (Great_circle_distance(0, 90, 0, 0) );
 
 

No comments:

Post a Comment