Guest User

Untitled

a guest
Feb 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import arcpy
  2. from random import *
  3.  
  4. rows = arcpy.UpdateCursor(r"C:\new_shapefile2.shp")
  5. shape = arcpy.Describe("C:\new_shapefile2.shp").shapeFieldName
  6.  
  7. increment = range(-50,50,5)
  8. pos_neg = [-1,1]
  9.  
  10. for n,row in enumerate(rows):
  11. if n > 0:
  12. point = arcpy.Point(row.getValue(shape).getPart(0).X + (increment[n]*pos_neg[randrange(0,2,1)]), row.getValue(shape).getPart(0).Y + (increment[n]*pos_neg[randrange(0,2,1)]))
  13. row.setValue(shape, point)
  14. rows.updateRow(row)
  15. del rows
Add Comment
Please, Sign In to add comment