` Distance between two zip codes (longitude/latitude method) (David Bratovich ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

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 21, 2024, 3:42 am
This article has been viewed 35236 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: