# Splitting polylines according to coincident (or touching) points with other polylines?

The question is unfortunately not answered yet.

I'm looking for a method or python script to split polylines according to coincident points with other polylines, but avoid splitting the ones which just intersect (without a sharing point like the planarize or intersection tool in ArcGIS would produce). The "touches (second_geometry)" function might be a way but I have at the moment no clue how to solve it.

The image illustrates my aim. The yellow line hasn't changed, because it has no coincicent points with the red line. While the red line as well as the dark blue line is split into 4 different polylines, because both share a coincident point.

• I need to do the same thing - trying to use Openstreetmap data to input into a routing/network application which requires that lines are split in exactly the way described. OSM data has these features very commonly. – Rostranimin Mar 9 '15 at 16:54
• What is the purpose of not creating points by overlap on non tangent coincidences? Are you over-complicating your logical process as feature perform optimally as geometric topology and optimally otherwise, since we are using spatial geometry and not calculus or advanced physics. – lewis Apr 6 '15 at 22:21

Here is a solution for ArcGIS, you can use the code in your Python Window. Of course after adapting it to your paths and names. (and yes, the code is not very beautifully written)

1. I took the lines and converted them to Points.

2. I run the Near funktion with the Points as "From" and as "To" data. This function returns the distance to the nearest feature. If you use the same data as "From" and "To" it will ignore calculating distances to itsself and take the second nearest feature. If the distance to the second nearest Point is 0 we can conclude there are two points (=vertices in the original) at this Point.

3. Than I selected this Points with "NEAR_DIST" = 0 and

4. cut our Polyline there.

``````import arcpy

arcpy.FeatureVerticesToPoints_management("D:/Test.shp","D:/TestP.shp","ALL")
arcpy.Near_analysis("D:/TestP.shp","D:/TestP.shp","#","NO_LOCATION","NO_ANGLE")
arcpy.Select_analysis("D:/TestP.shp","D:/TestSel.shp","""\"NEAR_DIST\" = 0""")
arcpy.SplitLineAtPoint_management("D:/Test.shp","D:/TestSel.shp","D:/Result.shp","1 Meters")
``````

I wanted to suggest topology, but I do not think it will work.

How about extracting only points at intersections, then run the Split Line at Point tool.

Edits: I apologize for giving an answer without thinking the answer through.

This solution will create a points file at the line intersections (1), and then select only those points from your original points file that are at the intersections (3). Then split lines at the intersections (5).

1. Run one of these tools (this will create a points file based on line intersections):

Intersect > Output Type "Points"

Geometric Network > Only use your line file

3. Select By Location > Select From: "your points layer" Source Layer: Result from (1)

4. Extract the selected features

5. Split Line at Point

• I thought about something like this as well, using a point map and the Split line at Point toll - but how do I extract only the coincident points? – Sophie_R May 15 '13 at 18:52
• Perhaps select by location - overlapping features - export selected records. – Barrett May 15 '13 at 18:53
• I think I've to ask again, I tried it right now without success - how do I choose only 'overlapping features'? – Sophie_R May 15 '13 at 19:38
• Please upvote if the answer helps you: resources.arcgis.com/en/help/main/10.1/index.html#//… Choose "Intersects" or "Are within a distance of" and give it appropriate parameters – Barrett May 15 '13 at 19:58
• Old question, but: @Sophie_R there is a Select Layer by Location GP tool that allows you to use the same layer for both inputs. I think Barrett's approach might work with an additional step. If you do Feature Vertices to Points you'll get all the line vertices. By comparing those to the points generated by the Intersect as Points output, you can remove those Intersect points which do not have a matching FtV point. The remaining ones should just be the splits you want to make. – Chris W Mar 17 '15 at 23:18

If your data isn't that big you could export the features (Red and Blue line) to a separate FC then run "Features to Line" which will break your lines at the vertices (Red, Green, L-Blue, and Blue). Then append the data back into its former FC. Bottom line is your are going to have to (I suspect) isolate your Red and Blue lines so you can break it then merge or append them back to the original, but "Feature to Line " will accomplish what you are asking.