Last Update : Mar 2008
Geocode data for US Zips and Cities
Keywords : geocode, us zips, us city, gps
----
update : 16 March 2008
updated CITY files (csv and sql) - the previous versions had duplicate entries
---
While looking for FREE geocode information of US Zipcodes and US cities. I found a great database at populardata.com. The data, albeit a few years old, was pretty good. I made some improvements to that data and making my changes available.
Here are the files
- Zips (43,073 entries)
- zips_v2.csv.zip (685.79 KB) - US zipcodes and their geocodes (I have renamed it to version_2)
- zips_v2.sql.zip (732.83 KB) - Same CSV data in easy to import SQL format
- Cities (30,604 entries)
- cities.csv.zip (489.75 KB) - US cities and their geocodes
- cities.sql.zip (558.33 KB) - Same CSV data in easy to import SQL format
Improvements
The zips database from PopularData.com was missing a few entries. Most of them are geocoded now. I have used Google GeoCoder to do this. Original zips data had 153 zips missing geocode. My V2 has >4 zips that are not geocoded. Military zipcodes are not geocoded.
fix_zips.rb - ruby script I used to fix the zips
I ran into another issue while using the geocoded zipcodes. There are multiple zipcodes for a city. For example, City of Palo Alto has 9 zipcodes. So which one is the geocode for city of 'palo alto,ca'? What I found was, geocoders return the center of the city. This is a sensible choice.
So I have created mapping of City-State to GeoCodes. If the City had only one zip code then that geocode was used for the city. On the other hand, if a city had multiple zipcodes, I used geocoder to get the co-ords. Almost 2000 towns have multiple zips.
** Comment on this article **