Take the 2-minute tour ×
Open Data Stack Exchange is a question and answer site for developers and researchers interested in open data. It's 100% free, no registration required.

I have a data set with zipcodes and would like to do a bulk upload to a tool that will give me the cities each zip is in (US only.)

share|improve this question

2 Answers 2

up vote 6 down vote accepted

There is no simple answer to this question, because ZIP codes do not represent geographical areas. They represent postal delivery routes, which are sometimes simply a bank of PO boxes in a specific post office, and are sometimes an organization like a University which has its own internal mail processing services.

Therefore, not all ZIP Codes can truly be located in a city, and even those for which a geography can be reasonably defined, they are not necessarily located within a single city.

Probably the closest approximation you could get would be to start with the Census Bureau's ZIP code tabulation area (ZCTA) gazetteer file, which can be downloaded here. Then, using as many of the state-based "place" shape files as you need, load those into a GIS tool. Personally, I'd use PostGIS, but you might also be able to use QGIS, or if you can get your hands on a copy, ArcGIS (commercial software).

You could then:

  1. look up the ZCTA for a given ZIP code
  2. extract the INTPTLAT and INTPTLONG values, which are the lat/long for the "centroid" of the ZCTA
  3. use the GIS tool to identify the place geography which contains the ZCTA's centroid

You will probably have some ZIP codes which aren't in the ZCTA dataset, and it's not really precise, but it's probably good enough for a lot of cases.

share|improve this answer
    
is right but perhaps more technically accurate than is necessary (though not at all erroneous). Just seems like a little more than the original poster was looking for. –  Jeffrey Jul 24 '13 at 22:37
    
Also keep in mind that the city names you see in the postal data do not correspond with municipal borders. Some municipalities within the zip code do not show up at all in the post office city names, and some of the city names in the postal records don't correspond at all with a municipality.Here's a lookup tool provided by the USPS. tools.usps.com/go/ZipLookupAction_input –  Bob Gradeck Jul 25 '13 at 19:32
1  
Here is a useful blog post giving more detailed information about why matching zips to geographic area boundaries can be problematic. The post is about electoral districts, but issues are similar for city boundaries: sunlightfoundation.com/blog/2012/01/19/dont-use-zipcodes –  skyebend Aug 8 '13 at 18:21

Absolutely, and it's very easy to use. You can use the API anytime you like. Try out the demo here. This has previously been one of our paid services but we are making it 100% free and publicly available within the next few weeks. In the meantime, if you've got a list you need to process, send it to me (support@smartystreets.com) and I'm happy to do it for you while we finish rolling this out.

[I work at SmartyStreets, that's why I have inside information about it and can offer our services.]

share|improve this answer
3  
Thanks for the answer @Jeffrey and make sure that you put in a disclaimer when pointing to services or sites in which you are involved (e.g. "I work for company XYZ"). –  Jeanne Holm Jul 25 '13 at 11:11
    
Thanks for the reminder @JeanneHolm –  Jeffrey Jul 25 '13 at 14:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.