Wednesday, 15 July 2015

arcgis 10.5 - Adding vertex to line at point location using ArcPy?


I have a line layer and point layer on my ArcGIS project. The points are on the lines. I want to create vertex on lines at this point coordinates.


import arcpy

point_rows = arcpy.da.SearchCursor("D:\Test.gdb\MyPoints", ['OID@', 'SHAPE'])


rows = arcpy.UpdateCursor("D:\Test.gdb\MyLines")

for row in rows:
geom = row.SHAPE
for part in geom.getPart():
for pnt in point_rows:
row.X = pnt.X
row.Y = pnt.Y
rows.updateRow(row)


I could not add vertex on points, if point is on the line. How can I do this using arcpy?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...