Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Distance calculation by lattitude/longitude
Message
From
23/09/2005 07:47:26
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/09/2005 05:24:48
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01052304
Message ID:
01052327
Views:
21
>Hello,
>
>Does anyone know how to calculate the distance between 2 coordinates ?
>
>More details :
>I have the coordinates (longitude + lattitude) of customer X and I have the coordinates of customer Y.
>I have to calculate the distance between the coordinates (bird's-eye view or how do you say that :o)
>
>Any ideas ?


This is from FoxPro 2.x developer's guide as is:
Function GeoDist
parameters lat1,lng1,lat2,lng2
*
* Degrees to radian
*
x = sin(lat1) * sin(lat2) +;
    cos(lat1) * cos(lat2) * cos(lng2 - lng1)
return 3959 * acos(x)
However this is distance for "as the crown flies" - thanks Terry for the idiom. I'm sure you could get exact distances from activex like MapInfo, MapObjects ... North America has quite well data. Expedia Maps might have some web services.
PS: GeoDist result is in miles.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform