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 Par2: Distance between two zip codes (longitude/latitude method) 2009-04-10 -- David Bratovich point1_lat REAL
point1_long REAL
point2_lat REAL
point2_long REAL
RADIUS_ LONG
PI_ REAL
DEG_PER_RAD_ REAL
DISTANCE_ REAL
somewhere in your code...
point1_lat = 33.658179 !92718 IRVINE CA
point1_long = 117.711476
point2_lat = 38.875939 !20024 WASHINGTON DC
point2_long = 77.016028
do calc_distance
CALC_DISTANCE ROUTINE
RADIUS_ = 3958 !Earth's radius (miles)
PI_ = 3.1415926
DEG_PER_RAD_ = 57.29578 !Number of degrees/radian (for conversion)
DISTANCE_ = (RADIUS_*PI_*SQRT((POINT1_LAT - POINT2_LAT)*(POINT1_LAT -
POINT2_LAT)+COS(POINT1_LAT/DEG_PER_RAD_)*COS(POINT2_LAT/DEG_PER_RAD_)*(POINT1_LONG
- POINT2_LONG)*(POINT1_LONG - POINT2_LONG))/180)
MESSAGE('Distance = '& DISTANCE_ & ' Miles')
You can get a database of Zipcode Lat/Long on the net.
Today is November 23, 2024, 3:30 am This article has been viewed 35241 times.
|
|