Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import arcpy
  2. arcpy.env.workspace = arcpy.GetParameterAsText(0)
  3. point_feature = arcpy.GetParameterAsText(1)
  4. line_feature = arcpy.GetParameterAsText(2)
  5.  
  6. # Make backup copy of point feature class, since modification with
  7. # the Editing tools below is permanent
  8.  
  9. arcpy.CopyFeatures_management(point_feature, "point_feature_backup")
  10.  
  11. # Snapping-Tool
  12.  
  13. arcpy.Snap_edit(point_feature,[[line_feature,"EDGE","50 METERS"]])
  14.  
  15. # Getting the coordinates of the new snapped Point
  16.  
  17. with arcpy.da.SearchCursor(point_feature, ['SHAPE@XY']) as cursor:
  18. print ("Coordinates of the snapped point: {}".format(row[0]))
  19.  
  20. # Creating the new line, I used phantasy coordinates here, it was just a test, the new Coordinates should be on the already existing line 1,5m left and 1,5m right of the snapped point
  21. cursor = arcpy.da.InsertCursor(line_feature, ["SHAPE@"])
  22.  
  23. array = arcpy.Array([arcpy.Point(1823123.213, 6139654.819),
  24. arcpy.Point(1823123.244, 6139654.869)])
  25.  
  26. polyline = arcpy.Polyline(array)
  27.  
  28. cursor.insertRow([polyline])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement