Iterate Feature Class problem

4607
5
Jump to solution
07-27-2015 10:04 AM
nataliemartinkus1
Occasional Contributor

Hi All - I just got back from the ESRI Users Conference jazzed up to use ModelBuilder to streamline my workflow.  Of course everything worked beautifully in the demos, and now back in my office....

I would like to calculate the area in square miles for a whole bunch of shapefiles, and Im trying to use the Add Geometry Attributes tool.  I loaded all my shapefiles into a feature class (called 32dol_BDT_polys), and as you can see in the figure, my output from Iterate Feature Classes is the first shapefile in the folder, not the entire list of shapefiles.  I tried this with my input as a geodatabase and the same thing happened.

Ive also tried this with every other iterate tool and had no luck there either.

Please help.

0 Kudos
1 Solution

Accepted Solutions
FreddieGibson
Occasional Contributor III

The Collect Values tool would not be valid input for the Clip tool. In the above model you're using the iterator to select each feature. This selected feature is used within the Clip tool and the output name of the resulting clip feature uses a chosen value from the selected feature.

I would think in this case if you wanted to use Collect Values you'd be wanting to create a collection of the shapefiles created by the iterator. I've included a screenshot of how this model would work on my machine. The screenshot contains comments on the logic behind each tool used within the model.

2015-11-10_0838.png

View solution in original post

0 Kudos
5 Replies
FreddieGibson
Occasional Contributor III

I'm not sure if I'm understanding your description correctly. Are you asking why the output to the Iterate Feature Classes tool shows a single feature class instead of a collection of features? If so, that is because after executing this tool you'd only see the value from the last iteration of the model. If you wanted to see all of the values you'd need to add the Collect Values tool into your model.

Could you also verify what the variable "32dol_BDT_polys" represents. The iterator in this case should only take a workspace as input (i.e. folder, geodatabase, or feature dataset).

For the most part, your model looks fine to me. The Add Geometry Attributes tool doesn't create new output, so in your model it should iterate through all of the feature classes in your specified workspace and add the attributes you specified in the tool.

nataliemartinkus1
Occasional Contributor

Thank you.  None of the examples I looked at showed the Collect Values tool.  That should hopefully solve my problem.

0 Kudos
nataliemartinkus1
Occasional Contributor

I could never get the Collect Values to work. I tried linking the Collect Values output to the Clip tool, and Clip wouldn't recognize it as an input.  What DID work was to use the %Value% naming convention from the Iterate Feature Selection in the output.

0 Kudos
FreddieGibson
Occasional Contributor III

The Collect Values tool would not be valid input for the Clip tool. In the above model you're using the iterator to select each feature. This selected feature is used within the Clip tool and the output name of the resulting clip feature uses a chosen value from the selected feature.

I would think in this case if you wanted to use Collect Values you'd be wanting to create a collection of the shapefiles created by the iterator. I've included a screenshot of how this model would work on my machine. The screenshot contains comments on the logic behind each tool used within the model.

2015-11-10_0838.png

0 Kudos
nataliemartinkus1
Occasional Contributor

Thank you Freddie for taking the time to put that diagram together with the explanations.  It really helps in my understanding of the collect values tool.  Much appreciated.

0 Kudos