Select to view content in your preferred language

ModelBuilder - Iterate then Output New Feature Classes

6087
4
Jump to solution
11-12-2014 02:53 PM
ISP_graynic
Occasional Contributor II

I am having a problem with getting the desired output in ModelBuilder in ArcMap 10.2 and I may be overthinking it.  I want to take a Feature Class and Iterate Row Selection to go through and group features based on an attribute.  Then I want my output to be feature classes of all the different groups of features that were found by the iterator (different feature classes for points based on their county).  How do I do get this desired output?  I know the answer is probably fairly simple.

 

I appreciate any and all help!  Thank you!

0 Kudos
1 Solution

Accepted Solutions
ChrisDonohue__GISP
MVP Alum


I think Iterate Row Selection will work for you.  Note that there is a setting to change that will do the sorting by County that is built into the tool already.  Here's what you do: 

1. Click on the Iterate Row Selection tool in Modelbuilder.

2.  When the tool window opens, go to the "Group By Fields (optional)" pulldown and select the field that denotes your counties.

3.  Hit the Plus sign icon on the right to add it in.

4.  Hit OK.  Now the iterator will grab all the selected rows for each county.

In regards to outputting this, I think a "Copy Features" tool will work.  Attach this to the right of the Iterator.  Use the "Selected Rows" that come off the Iterator as the input to "Copy Features".

In regards to the output file names, if you want the county name included in the output, the "Value" from the Iterator (which will be county names) can be used as what they call an "in-line variable" to name the output.  Basically, in the file naming, one adds %Value% to the file name.  Each time the iterator runs and a file is made, the part with %Value% gets the County name.   This is very handy for keeping the files organized.

Here's some information on that.

http://resources.arcgis.com/en/help/main/10.2/index.html#/Examples_of_inline_model_variable_substitu...

Chris Donohue, GISP

View solution in original post

0 Kudos
4 Replies
ChrisDonohue__GISP
MVP Alum

A few quick questions to help sort out what you are trying to achieve:

How do you want the results grouped?  For example, would it work to output the Feature Classes for County A into a folder named County_A, then Feature Classes for County B into a County_B folder, etc?

Also, I was wondering if the intent is to select from each Feature Class only the features that fall within each County (i.e. the Feature Class contains features that fall in multiple counties)?

Chris Donohue, GISP

0 Kudos
ISP_graynic
Occasional Contributor II

Basically I have a feature class of statewide points for a 2 year period, but I want individual feature classes for the counties.  The feature class I have, has an attribute for the county.  I want to create separate feature classes based on that attribute.  My end goal is to create a KML for Google Earth in which you can turn on/off the different points for the various counties instead of just being able to turn on/off all the points in the state.

Thanks!

0 Kudos
ChrisDonohue__GISP
MVP Alum


I think Iterate Row Selection will work for you.  Note that there is a setting to change that will do the sorting by County that is built into the tool already.  Here's what you do: 

1. Click on the Iterate Row Selection tool in Modelbuilder.

2.  When the tool window opens, go to the "Group By Fields (optional)" pulldown and select the field that denotes your counties.

3.  Hit the Plus sign icon on the right to add it in.

4.  Hit OK.  Now the iterator will grab all the selected rows for each county.

In regards to outputting this, I think a "Copy Features" tool will work.  Attach this to the right of the Iterator.  Use the "Selected Rows" that come off the Iterator as the input to "Copy Features".

In regards to the output file names, if you want the county name included in the output, the "Value" from the Iterator (which will be county names) can be used as what they call an "in-line variable" to name the output.  Basically, in the file naming, one adds %Value% to the file name.  Each time the iterator runs and a file is made, the part with %Value% gets the County name.   This is very handy for keeping the files organized.

Here's some information on that.

http://resources.arcgis.com/en/help/main/10.2/index.html#/Examples_of_inline_model_variable_substitu...

Chris Donohue, GISP

0 Kudos
ISP_graynic
Occasional Contributor II

That worked perfectly.  Thanks for the help Chris!

ModelGeoNet.jpg

0 Kudos