Select feature tool in arcpy or model builder

386
2
02-04-2021 08:03 AM
Labels (1)
MargaretLawrimore
New Contributor

I want to include functionality in a model or python script so that a user could select a single polygon from a layer and use that as input for a a tool. So basically, I want a model version of the Select Features tool on the tools toolbar and I want to use the selected feature (i.e county) as input for a python script (tool). I have seen this interactive feature input, but do not think it will work exactly as I want.

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

The interactive feature input only works for a limited number of tools.  You will have to document your script/model to indicate that a selection is required or all features will be used.  You could limit it to the first feature by slicing off the first record a input. 

You could follow @CurtisPrice1 suggestion to use GetCount and compare it to the total number of records and bail if getCount is > 1

Solved: Interactively Selecting Features as a Model Parame... - GeoNet, The Esri Community

They will soon catch on if they missed you parameter's help message


... sort of retired...
0 Kudos
MargaretLawrimore
New Contributor

I am still not sure how to select a feature using interactive feature input. All I am seeing is creating a new feature. Is there a way to select a polygon from a layer and add that polygon to a new layer or export to new layer in model builder?

0 Kudos