I have lines that touch neighboring polygons. But in some cases line touch same polygons two times, which I do not need.

Thus, I would like to select those line that touch one polygons two times and remove them.

Or, I would like to select lines that touch and connect different polygons.

I am using ArcGIS 10.4.1 with python, arcpy library.

I would be happy to have any suggestions to solve the case.

enter image description here

  • 1
    That diagram isn't very clear. By "touch" do you mean "touch at a point"? Which lines in that diagram do you want to include?
    – Spacedman
    Commented Mar 15, 2018 at 10:09
  • Basically, the lines connect the vertices of polygons, as the line represent the Delaunay Triangulation edges. The edges touch neighboring polygons, but at the same time they touch vertices of their own to make a triangulation edges. Thus, I want to remove lines that touch same polygon and keep line that touch neighboring ones.
    – peter
    Commented Mar 15, 2018 at 10:20
  • 1
    You can Intersect lines with polygon with Point as ouput. You should then be able to select in some way to identify duplicate lines.
    – Bera
    Commented Mar 15, 2018 at 10:37
  • 1
    If you Intersect with Multipoint as the output, then the rows where vertex count is greater than one have multiple connections.
    – Vince
    Commented Mar 15, 2018 at 11:57

2 Answers 2


By construction, your lines are straight line segments touching one or two polygons (no other case is possible). So you could also use spatial join to get the number of feature that intersect your line, the select those with one single intersecting feature (meaning that they touch twice the same polygon). Below is an example when you right-click on the line layer to launch spatial join, but there is also a tool in the toolbox if you want to make a model or a script.

enter image description here

As a remark, in your case, selecting all the lines inside the convex hull of the polygons also yields the same result.


If the lines touch the polygons with their ends, then you can use Feature Vertices To Points to transform line's ends into points. Then use Tabulate Intersection to count how many points touch the polygon. enter image description here

Numbers at the picture are FIDs of each feature type (polygons, points, lines). As you can see in the table ORIG_FID field contain lines FID values. Next field PNT_COUNT contain number of point that lays on polygon object with FID values in field FID.

  • But, how can I know from that that a line that touches the same polygon two times from this?
    – peter
    Commented Mar 15, 2018 at 10:36
  • 1
    @peter See update. Commented Mar 15, 2018 at 11:23

Your Answer

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

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