Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. sr = arcpy.SpatialReference (...spatial reference info...) #spatial reference object
  2. moveLyr = "SnapToMeLayer" #layer to be snapped to edge or vertex
  3.  
  4. class MoveLeak (object):
  5. def onMouseUpMap(self, x, y, button, shift):
  6. point = arcpy.Point (x, y)
  7. clickGeom = arcpy.Geometry ("POINT", point, sr)
  8. arcpy.CreateFeatureclass_management ("in_memory", "pnt", "POINT",
  9. spatial_reference = sr)
  10. tempPntFc = r"in_memorypnt"
  11. with arcpy.da.InsertCursor (tempPntFc, "SHAPE@") as curs:
  12. curs.insertRow ((clickGeom,))
  13. #snap 6 feet distance used to allow wiggle room with click
  14. arcpy.Snap_edit (tempPntFc, [[moveLyr, "EDGE", "6 FEET"]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement