7

Is it possible from government sources? I've found a website that will sell the data, but I know all the data is out there for free, I just need to find it.

I've been looking through Census.gov, but it seems only have zip code data as it relates to other data.

I tried searching American FactFinder, but I ran in to issues such as this: Autocorrect to Cats (which searched for 'cats' when I was looking for ZCTAs, which I assume will have zip code data).

Census.gov's page on zip code data points the user to a link on USPS.com, which ends up 404-redirecting to their index page.

Data.gov returns just way too many results looking for zip code data, and paring down the list seemed fruitless: http://catalog.data.gov/dataset?q=zip+codes&sort=score+desc%2C+name+asc

I cannot, for the life of me, find this data.

migrated from datascience.stackexchange.com Mar 24 '15 at 10:17

This question came from our site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field.

6

Update: I recently found this data at GeoNames.org, among many related data sets. The file includes city, county, state, latitude and longitude. It would be a separate exercise to roll it up to MSA or CSA.

Direct link to US Postal codes ZIP file


For many people, the best way to get this data is to buy it. There's a cottage industry of data services that have been providing this to small businesses for years, the costs are pretty low, and the length of the rest of this answer verifies that it's involved, although certainly something you can do if you have some coding and data skills.

If you'd rather create this dataset than buy it, here are things to know:

The Census Bureau states:

The USPS ZIP Codes identify the individual post office or metropolitan area delivery station associated with mailing addresses. USPS ZIP Codes are not areal features but a collection of mail delivery routes.

If the distinction matters, much more information can be found on this page The key things to know: ZCTAs overlap city boundaries and certainly at least a few exist outside of any city boundary. Also, if you're starting from mailing addresses, you will probably have some ZIP codes which aren't in the ZCTA dataset. And, the USPS may have changed ZIP codes since the last time the Census Bureau produced ZCTA definitions. (Some commercial data vendors promise to keep up with those changes as another value-add.)

So anyway, this means that naming is not straightforward. The Census Bureau just uses the 5-digit reference ZIP Code as a label. If you want to assign them names based on the nearest town, etc, you have some work to do.

ZCTAs are areas, not points, but when you ask for the latitude and longitude, you're probably interested in the centroid. You can find this in the Census Bureau's ZIP code tabulation area (ZCTA) gazetteer file, which can be downloaded here. (You want the INTPTLAT and INTPTLONG columns.)

Once you have a ZCTA centroid, you can locate it in a CSA or MSA. GIS software makes this fairly straightforward, with shapefiles provided by the Census's TIGER program.

But your question is further complicated by this: to the Census Bureau, CSA and MSA are different (and overlapping) things.

The bureau doesn't use the term "MSA" but rather combine "metropolitan statistical areas" and "micropolitan statistical areas" into a set called "core based statistical areas" or CBSAs.

To the Census, CSAs are "Combined Statistical Areas" and they are composed of some groups of CBSAs that are economically related. Not all CBSAs are part of any CSA. On Wikipedia, there's a page of "primary statistical areas" that articulates which CBSAs aren't in any CSA, but I haven't seen a GIS shapefile that matches that list. But maybe you can get by with just the CBSAs.

2

It appears that obtaining this data is not as trivial, as it might seem at first. The following are my suggestions in regard to the requested data sources and other options. It seems that currently there are two relatively solid sources of the data you're looking for:

The following additional, but not official, not solid and somewhat outdated database, might be also helpful: http://federalgovernmentzipcodes.us (also check links in the "Other Sources ..." section, especially GNIS data set - however, the GNIS data is used in the SBA's Web service).

1

This is not the most efficient way, but if you have time, you can use freemaptools.com. There, you can enter a zip code and retrieve all cities and counties within up to a 625 mile radius around that zip code. If you can find the source data for this site, you are done (and I would love to know where you find it). But I am not sure their source data is easily parsed, so I imagine writing a python script to enter search criteria and retrieve the results for you, or just obtain a list of all zip codes and copy and paste each one into the search field and then copy and paste the results. Either way, please be sure to post when and where you find an answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy