Efficiently finding the 1st order neighbors of 200k polygons

المشرف العام

Administrator
طاقم الإدارة
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.



أكثر...
 
أعلى