4 ms·
Free US ZIP Code Database as CSV
- ConradHex 19y agoThe google maps API also has pretty good geocoding, for free. You can give it a location, and it will tell you not just lat/lng, but also how specific that location is. (Is it a zip code? A city name? An intersection? A precise address?)
- technoguyrob 19y agoI have a better and more recent one, courtesy of yours truly (don't spread it around): http://therobert.org/stuff/misc/5-digit%20Commercial.csv http://therobert.org/stuff/misc/5-digit%20Commercial.csv 7.7MB | February 2008 I need a database that shows the population in each zip code, too. If any good Samaritan can share, that would be great.
- rrival 19y agoseen http://infochimps.org/datasets http://infochimps.org/datasets ?
- technoguyrob 19y agoThat seems useful, but it's more aggregated data (by state & region, not zip).
- dsplaisted 19y ago> don't spread it around Why not? Is it not public domain, or are you worried about the load on your server, or what?
- technoguyrob 19y agoThe latter. You're free to upload it elsewhere and spread it, however.
- rbanffy 19y agobzip2 it. It will slash the size to a fraction of its current size.
- 0x44 19y agohttp://indistinct.org/5-digit%20Commercial.csv.bz2 http://indistinct.org/5-digit%20Commercial.csv.bz2 A small mirror.
- enf 19y agoThe census will generate that database for you: Go to http://factfinder.census.gov/servlet/DCGeoSelectServlet?ds_name=DEC_2000_SF1_U http://factfinder.census.gov/servlet/DCGeoSelectServlet?ds_n... Click "All 5-Digit ZIP Code Tabulation Areas" Click "GO" Click "P1. Total Population" Click "Add" Click "Next" Click "Start Download"
- rbitar 19y agoDoes anyone know a good resource for searching within an X mile radius given a zipcode?
- ConradHex 19y agoFirst, convert your locations and zip codes to latitude and longitude. Then use something like this: http://jan.ucc.nau.edu/~cvm/latlon_formula.html http://jan.ucc.nau.edu/~cvm/latlon_formula.html
- technoguyrob 19y agoDownload the database I posted in my other comment here, and try this SQL statement: SELECT z.ZIPcode, (sqrt((z.latitude-z2.latitude)*(z.latitude-z2.latitude)+(z.longtitude-z2.longtitude)*(z.longtitude-z2.longtitude)))) AS dist FROM `zip` AS `z`, `zip` AS `z2` WHERE `z2`.`ZIPcode = 'YOURZIPCODE' ORDER BY dist LIMIT 10 Might be faster if you do a query to get the lat and long for the ZIP code you need first, though. Hell, it would probably be fastest to skip the database all together and just import the data and loop the distance formula, recording the smallest distances as you go.
- rainface 19y agomySQL 'SELECT zip FROM '.insert table here.' WHERE (POW((69.1(tablelongitude-"'.$obj->longitude.'")cos('.$obj->latitude.'/57.3)),"2")+POW((69.1(tablelatitude-"'.$obj->latitude.'")),"2"))<('.$radius.''.$radius.') '; You need the origin long and lat, and the radius (distance), but the nice thing is the database does all the radius distance calculations internally without passing it to the scripting language, in a fraction of second depending on the server and DB. This is the query I used in http://mybandsupport.com http://mybandsupport.com. You can see the result by entering the zipcode in the splash screen and clicking search. The function takes your zip, gets the long and lat, then the DB compares it to every zip's (4500) long and lat to find every zip within 20 miles. Just a note: comparing every zip code and its distance and recording the distance to a DB would create upwards of 12 million records. This might be the breaking point for some.... I was thinking about doing it myself. Once I worked out the numbers I backed away. If you know the origin and destination long and lat this works well to calc distance. $dist = sin(deg2rad($this->lat1)) * sin(deg2rad($this->lat2)) + cos(deg2rad($this->lat1)) * cos(deg2rad($this->lat2)) * cos(deg2rad($theta));
- deleted 19y ago[deleted]