Click to See Complete Forum and Search --> : zipcodes


moiseszaragoza
06-30-2009, 06:04 PM
I need to find a way i can type a zipcode like 33308 and get all the zipcodes around it like 100 miles

any one where i can get a script like this?

WolfShade
07-02-2009, 02:15 PM
I doubt you can find it, but give http://www.cflib.org/ a look. They MIGHT have it.

^_^

TiGGi
07-06-2009, 02:21 PM
Here is a script that I use all the time but you need to find a zip code database with latitudes and longitudes. Google it and you'll find it. This script will work with SQL database, access db may be bit different due to math.

<cfquery name="passedzip" datasource="db" maxrows="1">
SELECT zipcode, latitude, longitude FROM ZIPCODERADIUS
WHERE ZIPcode >= '#zip#'
</cfquery>

<cfquery datasource="db" name="getZip" >
SELECT zipcode
FROM ZIPCODERADIUS
WHERE 3963 * (ACOS((SIN(round(#passedzip.latitude#,3)/57.2958) * SIN(latitude/57.2958)) +
(COS(round(#passedzip.latitude#,3)/57.2958) * COS(latitude/57.2958) *
COS(longitude/57.2958 - round(#passedzip.longitude#,3)/57.2958)))) <= #URL.radius#
ORDER BY zipcode
</cfquery>

moiseszaragoza
07-07-2009, 08:55 AM
Thanks
I will do that