Thursday 23 August 2018

arcgis desktop - Efficiently finding the 1st order neighbors of 200k polygons



For every one of the 208,781 Census block groups, I'd like to retrieve the FIPS IDs of all of its 1st order neighbors. I have all the TIGER boundaries downloaded and merged into a single 1GB shapefile.


I tried an ArcPython script that uses SelectLayerByLocation for BOUNDARY_TOUCHES at its core, but it takes over 1 second for each block group which is slower than I'd like. This is even after I limit the SelectLayerByLocation search to block groups in the same state. I found this script, but it also uses SelectLayerByLocation internally so it's not any faster.


The solution doesn't have to be Arc-based--I'm open to other packages, though I'm most comfortable coding with Python.



Answer



If you have access to ArcGIS 10.2 for Desktop, or possibly earlier, then I think the Polygon Neighbors (Analysis) tool which:



Creates a table with statistics based on polygon contiguity (overlaps, coincident edges, or nodes).


Polygon neighbors



may make this task much easier now.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...