Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Clarion in general: Calculate distance based on global position 2006-06-09 -- Len Lutz > Where did you find the formula to calculate distance? I have looked at
> the
> database from zipcodeworld, the data is there but we would need to be able
> to do that distance calculation.
For calculating distance, try this code. I have found it gives me pretty
accurate "DRIVING" distances (in miles) between two zipcodes
(Latitudes/Longitudes of zipcodes). If you want the actual, straight-line
distance between the centers of the zipcode areas, remove the " * 1.28" at
the end of the last line.
===================================
GetDist PROCEDURE (SREAL Lat1, SREAL Lon1, SREAL Lat2, SREAL
Lon2, *SREAL Distance)
rLat1 SREAL
rLon1 SREAL
rLat2 SREAL
rLon2 SREAL
Deg2Rad EQUATE(0.0174532925199e+000)
CODE
rLat1 = Deg2Rad * Lat1
rLon1 = Deg2Rad * Lon1
rLat2 = Deg2Rad * Lat2
rLon2 = Deg2Rad * Lon2
Distance = (3963.1 * (ACOS(SIN(rLat1) * SIN(rLat2) + COS(rLat1) *
COS(rLat2) * COS(rLon2 - rLon1))) * 1.28)
Today is November 21, 2024, 7:16 am This article has been viewed 35218 times. Google search has resulted in 18 hits on this article since January 25, 2004.
|
|