Hi, Does anyone know how to calculate the distance between two geographic coordinates(longitude and latitude)? Any help at all would be GREATLY appreciated, thanks :)
Printable View
Hi, Does anyone know how to calculate the distance between two geographic coordinates(longitude and latitude)? Any help at all would be GREATLY appreciated, thanks :)
Class TLocality contains method [I]Distance [/I]for calculating distance between two landmarks.
Or You can calculate distance via Haversinus (half the versed sine) formula:
[url]http://wiki.forum.nokia.com/index.php/How_to_calculate_distance_between_two_landmarks[/url]
The calculation is a bit simple:
First, calculate the distance between the two coordinates throght the cosine law:
cos(S) = sin(l1)*sin(l2)+cos(11)*cos(l2)*cos(dl)
where:
l1 and l2 are the latitude of the points
dl is the difference between the longitude of the points
[B]S[/B] is the arc linking the two points. The secound step is multiply this value by 6378,1km (the aproximated radius of the Earth).
Hi genoulcha, Welcome to Dibo !
Your approach is correct only if distance between the points short.