AnsweredAssumed Answered

Interactive script parameter

Question asked by dkwiens Champion on Jul 27, 2015
Latest reply on Jul 28, 2015 by dkwiens

Like a blind squirrel accidentally finding a nut, I managed to answer this question without understanding the main interesting point: collecting a click event and populating a script parameter with its coordinates.

 

Here's the final, working script in question:

 

#import modules    
import arcpy    
  
point = arcpy.GetParameterAsText(0)  #click  
An = "AnimalPoints" #target point feature class Animal Sightings  
    
for prow in arcpy.da.SearchCursor(point,'SHAPE@XY'):          
    x,y = prow[0]        
del prow    
     
point1 = arcpy.Point(x, y)    
ptGeometry = arcpy.PointGeometry(point1)  
  
with arcpy.da.InsertCursor(An,['SHAPE@XY']) as cursor:  
   cursor.insertRow([(x,y)])  

 

Can someone please explain in what context line 4 ("point = ...") could possibly be populated with coordinates from a click event on the map? My understanding is that this is run from a regular old script tool (parameter type = record set), in a regular old toolbox, not a Python Add-In.

Outcomes