shaydez — 2013-04-17T11:50:14-04:00 — #1
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?
kylewolfe — 2013-04-17T13:16:50-04:00 — #2
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.
shaydez — 2013-04-26T20:17:20-04:00 — #3
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)
oleolevfb — 2013-05-07T03:46:01-04:00 — #4
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