HOW TO
In ArcGIS Pro, creating point features from line feature vertices is useful in capturing detailed spatial data, for instance, extracting precise coordinates or examining vertex connectivity. This method is beneficial in network analysis, as it helps identify intersections and directional changes along line features such as roads or rivers. In ArcGIS Pro, the Feature Vertices To Points tool available with an ArcGIS Desktop Advanced license can be used for this purpose.
However, point features can also be generated from line feature vertices using ArcPy, which provides greater flexibility for automating and customizing the workflow. This article outlines the workflow to achieve this using ArcPy.
import arcpy
arcpy.env.workspace = r"<geodatabase_path>"
input_fc = "<line_layer>"
output_fc = "<point_output>"
arcpy.CreateFeatureclass_management(arcpy.env.workspace, output_fc, "POINT", spatial_reference=input_fc)
edit = arcpy.da.Editor(arcpy.env.workspace) edit.startEditing(False, True) edit.startOperation()
with arcpy.da.SearchCursor(input_fc, ["SHAPE@"]) as cursor: with arcpy.da.InsertCursor(output_fc, ["SHAPE@"]) as ins_cursor:; for row in cursor: for part in row[0]: for pnt in part: ins_cursor.insertRow([pnt])
edit.stopOperation() edit.stopEditing(True) print("Vertices extracted and saved as points successfully.")
The code below demonstrates the full working script.
import arcpy arcpy.env.workspace = r"C:\Users\user123\Documents\ArcGIS\Projects\MyProject95\MyProject95.gdb"
input_fc = "PTest" output_fc = "PTest_Points" arcpy.CreateFeatureclass_management(arcpy.env.workspace, output_fc, "POINT", spatial_reference=input_fc) edit = arcpy.da.Editor(arcpy.env.workspace) edit.startEditing(False, True) edit.startOperation() with arcpy.da.SearchCursor(input_fc, ["SHAPE@"]) as cursor: with arcpy.da.InsertCursor(output_fc, ["SHAPE@"]) as ins_cursor: for row in cursor: for part in row[0]: for pnt in part: ins_cursor.insertRow([pnt]) edit.stopOperation() edit.stopEditing(True) print("Vertices extracted and saved as points successfully.")
The map below displays the points created from the line feature vertices.
Get help from ArcGIS experts
Download the Esri Support App