1

I am working in ArcMap. I have a map of districts in South Carolina, and I'm trying to find the boundary length that every district has with every other district, and the boundary of South Carolina itself. I understand that the GeoProcessing tool Polygon Neighbors can find the boundary lengths between polygons, but I also need the length that a district has with the edge of the state.

I am trying to verify that whatever values I get here correspond accurately with the perimeter of each district, so I don't simply want to use the perimeter tool and subtract off the sum of other neighbor lengths.

I have considered creating a buffer polygon around the state to act as an "outside" district, but I'm not sure how to do that.

0

1 Answer 1

2

The trick here is counting number of neighbors that share polygon edges. Workflow for that using spatial join one to many:

arcpy.Integrate_management(in_features="COUNTIES #", cluster_tolerance="0.01 Meters")
arcpy.FeatureToLine_management(in_features="COUNTIES", out_feature_class="C:/SCRATCH/to_dissolve.shp", cluster_tolerance="", attributes="NO_ATTRIBUTES")
arcpy.Dissolve_management(in_features="to_dissolve", out_feature_class="C:/SCRATCH/edges.shp", dissolve_field="", statistics_fields="", multi_part="SINGLE_PART", unsplit_lines="DISSOLVE_LINES")
arcpy.SpatialJoin_analysis(target_features="edges", join_features="COUNTIES", out_feature_class="C:/SCRATCH/SCRATCH.gdb/SJ_12M", join_operation="JOIN_ONE_TO_MANY", join_type="KEEP_ALL", field_mapping="", match_option="SHARE_A_LINE_SEGMENT_WITH", search_radius="", distance_field_name="")

Add field NEIGHBOURS, compute count of polygons per TARGET_FID in spatial join output, transfer it back to the same table:

enter image description here

Visually inspect spatial joins and make sure outer (1 neighbour) and inside edges (2 neighbours) located where expected (if this is not the case, fix topology of polygons):

enter image description here

  • Select outer (1 neighbour) spatial joins (edges) and transfer their lengths to relevant field in counties table using JOIN_FID for join.
  • Select inside (2 neighbour) spatial joins, summarise by JOIN_FID and transfer their total length to relevant field in counties table using JOIN_FID for join:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.