AnsweredAssumed Answered

Create multiple points with mouse click

Question asked by 2Quik1 on Jul 24, 2015
Latest reply on Jul 29, 2015 by dkwiens

I would like to be able to click multiple locations and create points where i click and populate each points x, y. i have the current code but only creates one point, so i needs help.

 

current code.

 

#import modules  
import arcpy  

arcpy.env.qualifiedFieldNames = False
An = "AnimalSightings" #target point feature class Animal Sightings

mxd = arcpy.mapping.MapDocument("CURRENT")  
df = arcpy.mapping.ListDataFrames(mxd)[0]  
dfsr = df.spatialReference  
fcsr = arcpy.Describe(An).spatialReference  
if dfsr.name == fcsr.name:  
    """Now do your work"""  

point = arcpy.GetParameterAsText(0)  #click

  
for prow in arcpy.da.SearchCursor(point,'SHAPE@XY'):        
    x,y = prow[0]      
del prow  


row_value = [x,y,(x,y)]  
with arcpy.da.InsertCursor(An,('POINT_X', 'POINT_Y','SHAPE@XY')) as cursor:
    cursor.insertRow(row_value)

Outcomes