In case anyone is interested, I tested an Add-In to do this inside ArcMap (I needed the Add-In practice anyways 🙂 😞
import arcpy
import pythonaddins
from arcpy import mapping as m
class AddFeatureWithXY(object):
# Implement the add in
def __init__(self):
self.enabled = True
self.cursor = 3 # cross
def onMouseDownMap(self, x, y, button, shift):
# listens for mouse down event
mxd = m.MapDocument("current")
df = m.ListDataFrames(mxd)[0]
lyr = m.ListLayers(mxd, 'Addresses', df)[0]
# Get XY from click
pt=arcpy.PointGeometry(arcpy.Point(x,y))
insert = tuple([pt, x, y])
# insert rows
coord_fields = ['SHAPE@','POINT_X','POINT_Y']
with arcpy.da.InsertCursor(lyr, coord_fields) as irows:
irows.insertRow(insert)
arcpy.RefreshActiveView()
pythonaddins.MessageBox('Added X,Y coords to table', 'Message', '0')