No ZIP Codes for You
The U.S. Postal Service denied our FOIA request for a list of current ZIP Codes, because the information is “proprietary business information” and its release would not be considered a “good business practice”. This followed their refusal to license us their online ZIP Code API because we were not planning on using it for USPS shipping. They suggested that we purchase a $3,000 per year “data product” containing the information. This offering, however, has so many technical and licensing hurdles that it’s essentially unusable.
Our Hunt for ZIP Codes Started When We Became Interested in Mapping Restaurant Health Inspections
We create apps which increase access to laws and government info. This is mostly a labor of love, earning enough money to cover the costs of running the Internet servers.
There isn’t yet an app or website for easily browsing restaurant health inspections in Multnomah County, Oregon. The County does have a web app, but it has a lot of issues, and won’t be upgraded until late next year.
Critically, while sorting through the County’s data for each restaurant, we found that the city is missing, although the ZIP Code is there. And so to place these on a map we needed a current list of ZIP Codes and corresponding city names.
Our search for this simple information culminated in this rejected FOIA request to the U.S. Postal Service. This is because our “open source” open-government use of the data is not an acceptable reason to either 1) provide us online access to the USPS API, or 2) send us a current list of ZIP Codes and cities.
You can get a shapefile for all US zip codes from
ftp://ftp2.census.gov/geo/tiger/TIGER2013/ZCTA5/
Then use a program like QGIS to overlay city boundaries to solve your problem.
LikeLike
Thanks Max. I’ve looked into this. I believe it won’t work because the Census data is very different from the (updated daily) USPS ZIP Codes.
LikeLike
The zip codes the USPS uses are based on individual points, while the Census ones are an interpolated area based on that. For what you are trying to do with restaurants in well established areas, the Census files should be fine. If you really wanted to be safe, you could CASS certify all your addresses, which will ensure the ZIP is up to date, and crosscheck the points to the zip code polygons and adjust accordingly.
LikeLike
the usps stuff aren’t actually polygons but routes that mail carriers use. Disregarding the troubling issues relating to open data, the census stuff will probably be a bit more helpful to you overall, because any marginal decrease in accuracy to it is going to be offset by it being a polygon structure which is going to be massively more useful.
LikeLike
I could be wrong, but my recollection is that some ZIP codes do not have a matching ZCTA; some are subsumed into a different ZCTA.
LikeLike
Robb,
I’d love to work with you not only to get this information from the USPS, but also to change their stance on sharing this sort of data. Please get in touch via my email address if interested.
LikeLike
This is not an problem only of you. Her in Brazil our Correios (same like U.S. Postal Service) too restrict acess to Zip Codes.
So as Max Shapiro write we need do web crawlers to acquire this information or acquire from others
Good luck in your war
LikeLike
I’m a developer at SmartyStreets — and I know, ZIP codes are tricky. They tend to change (monthly), so you’d want to keep your list, if any, updated. On one hand, the USPS has good reason for keeping a tight lid on ZIP codes: they have little practical value outside of mailing. ZIP codes aren’t geographical regions, so they’re hard to put on a map. (They’re actually lines, kind of, see this Stack Overflow post: http://stackoverflow.com/questions/13112899/how-to-get-the-bounding-coordinates-for-a-us-postalzip-code/13114578#13114578 ) They probably want to maintain the quality of ZIP code data that’s available, instead of having it decay in various unauthorized venues. (Yes, on the other hand, there’s a strong case to be made for having them be open.)
Incidentally, have you considered a type of low-cost API from a vendor such as SmartyStreets to augment/fill-out your data? Check out the TOS. Interestingly, you’ll find they are less restrictive than the USPS’ terms (as long as you’re not reverse-engineering a list of ZIP codes just to have them).
LikeLike
That’s nonsense. They don’t own all the numbers from 00001 up to 99999. Nothing to keep you from creating your own list. With that said, I’d be happy to give you an updated list anytime you need it. We deal with the USPS and their address data, so we get an update monthly.
let me know – jeffrey@smartystreets.com
LikeLike
This is also a problem here in Sweden, the zip code database here is not open either, and crumbled with restrictions on what you can do with it.
LikeLike
The USPS is a print advertising business first and foremost. Now that I pay most of my bills online, something like 90 percent by weight of the mail I receive is advertising, which the ‘letter’ carriers are required to deliver.
If FedX or UPS showed up at my door every day with stuff I didn’t want, I’d get a restraining order. But because the USPS has this ‘unique’ dual mandate from Congress, I can’t do anything about it.
It’s a shocking waste – the machines that print the junk and sort it, the manpower and vehicle fuel to deliver it to the routes and so on.
LikeLike
You could probably put a hold on your mail, if you’re really not getting anything.
LikeLike
Here is another source
http://www.geonames.org/
Naturally this does not address the issue of the USPS restricting access to the better data pool, but the closest open source zip I have found.
LikeLike
Weird Until now I never thought this could be a problem. Granted, I only know this system http://en.wikipedia.org/wiki/Postal_codes_in_Switzerland_and_Liechtenstein and this is nicely structured. And of a small country.
Also: https://match.post.ch/
Muahahaha.
LikeLike
We get a CD of their City/State/Zip product monthly for $60/year.
https://ribbs.usps.gov/index.cfm?page=addressing
LikeLike
FYI if you just want to go ZIP->city, I think the “City State” file will give you what you need at a mere $385/year, updated quarterly, IIRC. If you google “ctystate.txt” you might find a sample.
I, too, find it fairly absurd that this data is not freely available, especially for non-profit uses like yours (presumably).
LikeLike
If you just need the list of zip codes I think this should work:
https://ribbs.usps.gov/files/Addressing/AREA_DISTRICTZIPLIST/AREADIST_ZIP5.TXT
also noted that number of lines in this is ~41K while geonames has ~43K. Not sure if usps has merged some zips, does anyone know?
LikeLike
Somewhere in the auto complete for google maps, when you enter the zip code, it provides the city and location. Is there a way to translate that code to read it for your purposes?
LikeLike
http://www.unitedstateszipcodes.org/zip-code-database/
It is only $39.99. Free for personal/ research purposes. Since you are apparently only wanting to determine the city from the zip code, I don’t see why you need to update it very often, if you are using a static list of addresses. The city will not usually change, the zip codes sometimes are split or changed.
LikeLike
http://www.unitedstateszipcodes.org/or/ is free
LikeLike