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.
it is hard to tell from the picture an example of a line that touches twice and where the intersection occurs.
Can you narrow in an example
Here, polygons number 0 and polygon number 3 are connected with blue lines. But there are some lines in black that only touch one polygons, touching only polygon number 0 or polygons number 3.
Hi Azimjon,
One way to accomplish this:
1. Convert the lines end points to vertices using the Feature Vertices to Points
2. Run a spatial join on the vertices point layer and the polygon layer
3. Run the summary statistics tool on the spatial join output specifying the following:
LINE_ID = unique identifier for line feature class
ID = unique identifier for polygon feature class
4. In the output table select all records that have a frequency of 2:
This will provide you with the unique LINE_ID for the features that touch the same polygon twice.