You said you already have a database of zip codes. You'll also need columns for latitude and longitude for each zip. This one isn't too bad: http://www.populardata.com
Then, this formula will give you the distance in miles between two sets of LAT/LONG:
<cfset radlat1 = ((pi() * lat1)/180)>
<cfset radlat2 = ((pi() * lat2)/180)>
<cfset radlon1 = ((pi() * lon1)/180)>
<cfset radlon2 = ((pi() * lon2)/180)>
<cfset theta = lon1-lon2>
<cfset radtheta = ((pi() * theta)/180)>
<cfset dist = ((60 * 1.1515) * (180 / pi()) * (ACos((Sin(radlat1) * Sin(radlat2))
+ (Cos(radlat1) * Cos(radlat2) * Cos(radtheta)))))>
Main Topics
Browse All Topics





by: dgrafxPosted on 2008-01-14 at 03:12:39ID: 20652200
Hello Electricians
I don't quite understand what you want to get.
Do you want to get the users city from their zipcode?
or
Do you want to get neighboring cities from what they enter?
I guess I don't understand exactly what you are wanting to do.