# Thread: Calculating Distance between Two Locations?

1. ## Calculating Distance between Two Locations?

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

2. ## Re: Calculating Distance between Two Locations?

Class TLocality contains method Distance for calculating distance between two landmarks.

Or You can calculate distance via Haversinus (half the versed sine) formula:
http://wiki.forum.nokia.com/index.ph..._two_landmarks

3. ## Re: Calculating Distance between Two Locations?

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

S is the arc linking the two points. The secound step is multiply this value by 6378,1km (the aproximated radius of the Earth).

4. ## Re: Calculating Distance between Two Locations?

Hi genoulcha, Welcome to Dibo !

Your approach is correct only if distance between the points short.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•