I downloaded a DB of Zipcodes with Latitude and Longitude.
I want to know if its possible to get a list of zipcodes within a radius of a given zipcode.
For example i type
33433 and i should get 10miles of zipcodes
would i need to use API for this or can i do it specifically in my database?
This would have to be run against the entire db each time you want to calculate it, can be costly.
Another option if you feel like using MongoDB: http://docs.mongodb.org/manual/core/geospatial-indexes/
There are zip code dbs that should have long / lat with it.
Posting this for other to find --
Found this class.. Works like freakn charm..
Results it spits out
Get the distance between 2 zip codes
Zip code 33431 is 14.02 miles away from zip code 33309
Zip code 33431 is 1726.47 kilometers away from the city Boca Raton
Zip code 33431 is 17.36 miles away from the city Fort Lauderdale
Get all zip codes between 10 and 15 miles from 97214
Zip code 33436 is 10.4 miles away from 33431 (Palm Beach county)
Zip code 33435 is 10.5 miles away from 33431 (Palm Beach county)
Zip code 33076 is 10.8 miles away from 33431 (Broward county)
Here you can find the sources codes for the zip code radius calculation not only in PHP but also in ASP.NET (C#) and Coldfusion: http://www.zipcodesoft.com/zip-codes-in-a-radius
An interesting add-on could be to calculate the distance as the road distance instead of as the crow flies.
This page shows how to to that: http://www.zipcodesoft.com/distance-between-zip-codes
The necessary zip code database you can download here: http://www.zipcodesoft.com
This topic is now closed. New replies are no longer allowed.