Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to calculate the distance 2 points using latitude and longitude, i used the Haversine formula to calculate it but when i compare the result with Google Map km, the result isn't same, please tell me, how can i convert the result of Haversine to the result of Google Map km.
Haversine formula:
( 2 *
(atan2(
sqrt((sqr(sin(((Latitude_etabli * Pi() / 180) - (latitude_ville * Pi() / 180)) / 2))
+ ((cos((latitude_ville * Pi() / 180)) * cos((Latitude_etabli * Pi() / 180)))
* sqr(sin(((Longitude_etabli * Pi() / 180) - (longitude_ville * Pi() / 180)) / 2))
)
)),
sqrt((1-(
sqr(sin(((Latitude_etabli * Pi() / 180) - (latitude_ville * Pi() / 180)) / 2))
+ ((cos((latitude_ville * Pi() / 180)) * cos((Latitude_etabli * Pi() / 180)))
* sqr(sin(((Longitude_etabli * Pi() / 180) - (longitude_ville * Pi() / 180)) / 2))
)
))
)))) * 6371 as Distance_km
Lat_1: 47.766667 Long_1: 2.8
Lat_2 : 47.085134 Long_2: 2.436788
Distance in Haversine formuma: 80,56 km
Distance in Google Map : 92.1 km
Thanks for yours help!
my calc:
DataShort: Load * ,6371 * (2 * Atan2( sqrt((sin(((lat2-lat1) * Pi() /180) /2) * sin(((lat2-lat1) * Pi() /180) /2) +sin(((lon2-lon1) * Pi() /180) /2) * sin(((lon2-lon1) * Pi() /180) /2) * cos(((lat1) * Pi() /180) ) * cos(((lat2) * Pi() /180) ))) , sqrt(1-(sin(((lat2-lat1) * Pi() /180) /2) * sin(((lat2-lat1) * Pi() /180) /2) +sin(((lon2-lon1) * Pi() /180) /2) * sin(((lon2-lon1) * Pi() /180) /2) * cos(((lat1) * Pi() /180) ) * cos(((lat2) * Pi() /180) ))) )) AS Distance Resident Data;