Hi Brains Trust. I'm doing some cleanup work on a road network to make it suitable for Network Analysis, and have come across the following issue. One of the steps I have is usin the Integrate tool to align spatially different datasets. Unfortunately, a side effect of this is that lines passing across each other which normally don't intersect (as in no co-located vertices which Network Analyst uses to permit turns) now do. I've identified a lot of overpass/underpass areas which need to have these no-turn intersections cleaned, but can't find a way to bulk delete vertices when identified by an intersecting polygon. Any ideas out there on how to achieve this?
Below screenshot shows where a route turns off a bridge instead of following along the off ramp.
LindsayRaabe_FPCWA_0-1643076407010.png
Solved! Go to Solution.
Hi. Do you have an advanced license? In a nut shell, I use one of these to:
At the time I didn't figure out how to do it without an advanced license, but with some playing around with python, now I have!
Starting data:
LindsayRaabe_FPCWA_0-1752236438211.png
1. Convert lines to points using below python code:
import arcpy
# Set paths
input_fc = r"C:\YourProject\YourGDB.gdb\YourPolylineLayer"
output_fc = r"C:\YourProject\YourGDB.gdb\PolylineVertices"
# Use the same spatial reference as the input
spatial_ref = arcpy.Describe(input_fc).spatialReference
# Create output point feature class
arcpy.CreateFeatureclass_management(
out_path=r"C:\YourProject\YourGDB.gdb",
out_name="PolylineVertices",
geometry_type="POINT",
spatial_reference=spatial_ref
)
# Add a field to track original feature ID (optional)
arcpy.AddField_management(output_fc, "SourceID", "LONG")
# Insert points
with arcpy.da.SearchCursor(input_fc, ["OID@", "SHAPE@"]) as search_cursor, \
arcpy.da.InsertCursor(output_fc, ["SHAPE@", "SourceID"]) as insert_cursor:
for oid, polyline in search_cursor:
for part in polyline:
for point in part:
if point:
insert_cursor.insertRow((point, oid))
LindsayRaabe_FPCWA_1-1752236489295.png
2. Use Select by Location to select undesirable points
LindsayRaabe_FPCWA_2-1752236549637.png
3. Use Delete Rows to delete selected points
LindsayRaabe_FPCWA_3-1752236627431.png
LindsayRaabe_FPCWA_4-1752236712760.png
4. Use Points to Line to reconstruct lines from remaining points
LindsayRaabe_FPCWA_5-1752236802454.png
Turn that python code into a python tool and you can string that into a model with the rest of the tools to repeat as needed.
Erase Point (Editing)—ArcGIS Pro | Documentation
assuming you aren't talking about manual editing
Close! Yes, I'm not talking manually - that I have well and truly sorted. Trying to automate/script a faster solution for preidentified "issue" intersections.
The Erase Point tool is almost what I need, except I want vertices on a line - not standalone point features.
I've just found this post (https://gis.stackexchange.com/questions/227268/delete-line-vertex-from-polyline-layer-using-point-fe...) that leads me to the Feature Vertices to Points tool, which might have been helpful in a larger convert, select, rebuild process, but I don't have access to an Advanced licence (only Standard).
Also just found this (https://gis.stackexchange.com/questions/227115/remove-polyline-vertex-outside-polygon-in-arcpy) from 5 years ago so will see if I can make it work. I've got a trial of XTools Pro which gives me the Line to Point option, so at least I have something to play with.
@LindsayRaabe_FPCWA did you ever find a solution to this? I have a similar situation with a water distribution network.
Hi. Do you have an advanced license? In a nut shell, I use one of these to:
At the time I didn't figure out how to do it without an advanced license, but with some playing around with python, now I have!
Starting data:
LindsayRaabe_FPCWA_0-1752236438211.png
1. Convert lines to points using below python code:
import arcpy
# Set paths
input_fc = r"C:\YourProject\YourGDB.gdb\YourPolylineLayer"
output_fc = r"C:\YourProject\YourGDB.gdb\PolylineVertices"
# Use the same spatial reference as the input
spatial_ref = arcpy.Describe(input_fc).spatialReference
# Create output point feature class
arcpy.CreateFeatureclass_management(
out_path=r"C:\YourProject\YourGDB.gdb",
out_name="PolylineVertices",
geometry_type="POINT",
spatial_reference=spatial_ref
)
# Add a field to track original feature ID (optional)
arcpy.AddField_management(output_fc, "SourceID", "LONG")
# Insert points
with arcpy.da.SearchCursor(input_fc, ["OID@", "SHAPE@"]) as search_cursor, \
arcpy.da.InsertCursor(output_fc, ["SHAPE@", "SourceID"]) as insert_cursor:
for oid, polyline in search_cursor:
for part in polyline:
for point in part:
if point:
insert_cursor.insertRow((point, oid))
LindsayRaabe_FPCWA_1-1752236489295.png
2. Use Select by Location to select undesirable points
LindsayRaabe_FPCWA_2-1752236549637.png
3. Use Delete Rows to delete selected points
LindsayRaabe_FPCWA_3-1752236627431.png
LindsayRaabe_FPCWA_4-1752236712760.png
4. Use Points to Line to reconstruct lines from remaining points
LindsayRaabe_FPCWA_5-1752236802454.png
Turn that python code into a python tool and you can string that into a model with the rest of the tools to repeat as needed.
My use case was a little different, but this general workflow worked like a charm! I have a water distribution network where lines cross each other, but aren't actually connected. So I needed to delete all of the vertices where lines intersected where there wasn't actually a point feature connecting them.
So my workflow was basically
This was a really easy way to accomplish this, thanks for the insight!
Glad you found it useful and managed to adapt it to your needs!