Merge lines IF they share adjacent polygon(s) (arcgis/arcpy)

المشرف العام

Administrator
طاقم الإدارة
I have lots of lines that I need to merge IF and only if they share the same polygon(s). All lines are made from the polygons (copy-paste into line) so they all snap.



In this little example line 499, 451, 447, 452 and 448 could be merged since they all share polygon 136 and none polygon on the outer side of the line.
Similarly line 442, 443 and 427 could be merged since they all share polygon 133 on the inner side and polygon 136 on the outer side.

My guess so far is to make points on the middle of each line (Features->Feature Vertices to Point and point type [MID]). And then do a Spatial Join where I use this new point layer as Target and my polygonlayer as Join [Join-One-To-Many]. Then I get a new feature that tells me the line-to-polygon relation; line = ORIG_FID and polygon JOIN_FID.



Line 427 is adjacent to polygon 133 and 136.
Line 443 is adjacent to polygon 133 and 136.
Line 447 is adjacent only to polygon 136.

And this is where I stop.
I now need a script that checks which polygon(s) each line is adjacent to and if two or more lines share exactly the same polygon or polygons then merge.



أكثر...
 
أعلى