I need a list in the form of adjacency list that contains all zip codes in the United States that each has a list of adjacent zip codes. I tried searching for it on the internet. Many of them only provide a list, but none of them had a list showing the adjacent list of zip codes. How do I find something like that?

The closest thing I found is a list of counties and their adjacent counties. There are several websites that I believe that they have the information but they are using it for applets like this website, http://www.freemaptools.com/find-zip-codes-inside-radius.htm

If no data is available, could I use the counties list to generate the said list?

EDIT: OP here, I was new to the whole GIS system. I don't know which software to use. I decided to try ArcGIS trial. I downloaded ArcGIS and that .lpk file. But I have no idea how to properly load .lpk in a python script and run PolygonNeighbors_analysis function. ArcPy Documentation and Google are not giving me a clear answer. Can anyone show me how to load .lpk package and use the function? Thanks

EDIT2: I think I should have mentioned that I want that list in a simple .txt file. I think I could do this with ArcPY to collect all zip codes and their neighbors, then store it in the .txt file. My current obstacle to this is that I have no idea how to load .lpk file to ArcPY.

EDIT3: I got it to work! By following what Barrett described, I got a raw .txt file of zip codes and their neighbors. I cleaned it up with my small program. It looks good. Thanks for help!

migrated from stats.stackexchange.com Jul 28 '14 at 20:05

This question came from our site for people interested in statistics, machine learning, data analysis, data mining, and data visualization.

  • Would you be able to edit your question to indicate the GIS software and version you have available to "generate the said list", please? – PolyGeo Jul 28 '14 at 21:59
  • See my updated answer - you do not need to use ArcPy. Open ArcToolbox, Find & Open the Tool, then Drag the layer into the tool. – Barrett Jul 29 '14 at 19:44
  • Can you make this zip code adjacency file available? thank you – Ming-Chih Kao Apr 1 '17 at 20:46
  • Do you mind sharing your txt file of zip codes with their neighbor zip codes? Thanks – Rai May 5 '17 at 19:35

Get a zip-code boundary layer and run Polygon Neighbors. Review How Polygon Neighbors Works and Up-To-Date Zip-Code Boundaries

Picture below might be different than your ArcMap looks, but the buttons and procedure should be the same.

ArcToolbox Example

Perhaps this is an open-source solution. I have not tested or used this solution which seems to require GRASS 6+ : from the GRASS users mailing list

Daniel Isenegger wrote:

Hi, i work with grass 5.7 having the attribute data in postgres-DB.

in a polygon-shapefile containing several hundred of polygons i want to analyze for each polygon which neighboring polygons it has. Conceptually i see there 2 cases: 1) neighboring polygons sharing a common boundary with the current polygon: these polygons should be selectable by identifying the identifiers of the border-lines of the current polygon and search over all border-lines of all polygons for those identifiers. here my question is: how to identify the identifiers of all border-lines of a polygon?

v.category layer=2 type=boundary to assign cat to boundaries

v.to.db option=sides -p

  • 1
    That's a solution Barret, however the OP has not indicated the software yet. I would recommend if you're going to assume software that you assume open source as if they don't have it they can install it without cost. It is a nice, neat solution for users of ArcGIS though. – Michael Stimson Jul 28 '14 at 22:07
  • @MichaelMiles-Stimson good point. If this is a one-off calculation the OP could consider installing a trial version of ArcGIS – Stephen Lead Jul 29 '14 at 1:55
  • Point Taken, Michael. – Barrett Jul 29 '14 at 13:10
  • ESRI offers free ZIp Code Boundaries, arcgis.com/home/item.html?id=8d2012a2016e484dafaac0451f9aea24. You need ArcGIS to use this layer. – klewis Jul 29 '14 at 13:46