I am quite a beginner with Python, thus I will be grateful for your help . I want to create multiple points on my map. I managed to do that but unfortunately my attribute table is not updating (it is always only one row even I added multiple points). Could you take a look at my code at tell me where is the problem? For any help thank you so much!
"""Implementation for new_addin.tool (Tool)"""
self.enabled = True
self.shape = "circle" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.
def onMouseDown(self, x, y, button, shift):
def onMouseDownMap(self, x, y, button, shift):
#workspace = r"\\\\abc\\home\\xxx\\Documents\\ArcGIS\\Default.gdb"
#adding points to the map
mxd = arcpy.mapping.MapDocument ("CURRENT")
sr = mxd.activeDataFrame.spatialReference
pntFc = r"\\abc\home\xxx\Documents\ArcGIS\treepoints"
pt = arcpy.Point()
pt.X = float(x)
pt.Y = float(y)
ptGeoms = [arcpy.Geometry ("POINT", pt, sr)]
if not arcpy.Exists (pntFc):
with arcpy.da.InsertCursor (pntFc, "SHAPE@") as iCurs: