 # Thread: Get distance from 2 locations (Lat/Long)?

1. ## Get distance from 2 locations (Lat/Long)?

I've searched the web for a formula to calculate the distance from 2 points with latitude/longitude:

ACos(Sin(value( "lat1" ))*Sin(value( "lat2" ))+Cos(value( "lat1" ))*Cos(value( "lat2" ))*Cos(value( "long2" )-value( "long1" )))*6371.0

(6371 is the earth radius in km) from here: http://www.movable-type.co.uk/scripts/latlong.html and here: http://itouchmap.com/latlong.html

but the distance dont work for me (in my case should be under 10km, the formula shows me something like 278)

what I'm doing wrong here?!?

Richie 2. Here is some functions I have used for this calc in the past that are very accurate:

http://www.galcho.com/Blog/default.aspx?date=2007-05-17

You should be able to convert the T-SQL or C# function easily. 3. Does the Expression Editor Support a radians function?!? 4. SOLUTION!!:

(ACos(Sin(value( "lat1" ))*Sin(value( "lat2" ))+Cos(value( "lat1" ))*Cos(value( "lat2" ))*Cos(value( "long2" )-value( "long1" )))*6371.0)/180*3.141592654

(what i have missed was the conversation to radiant) 5. *Bookmarks this thread* Always such a complicated equation, easier to refer here when needed  #### Posting Permissions

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