We have already discussed two types of iterators, the layer iterators ( ArcGIS Model Builder: how
to spread a template into a dataset in input ) and the digital iterators ( ArcGIS Model Builder: FOR and WHILE
Therefore still remains the last type of iterators: entities iterators.
What are the entities iterators ?
You know the difference between ArcCatalog and ArcMap: when it refers to
an operation performed on a layer ( creation , copy , projection, …) you use
ArcCatalog. When it refers to intervene on a layer entities (modification,
addition , …) you use ArcMap. In this case, it is similar : when you want apply
a processing to various layers, you use the layer iterators.
There are three types of iterators:
- Iterate the selection entity
- Iterate the selection records
- Iterate the field values
The three iterators correspond to the same objective: select the input
entities layer according to the values included in an attribute field . So ,
why three iterators ? It ‘s not because of the selection that you make (it is always
the same), but about the the iterator output.
If you are reading this article, then, you have already experienced some trouble
with Model Builder. Therefore you know that the tools of the toolbox are unpredictable
and they do not work (randomly). You have tools that ask for a Feature Class as
input data as, others that apply to tabular views (Row selection) and others that
ask for a Value . The three iterators correspond to these three types of
toolbox tool conditions .
To be clear, you have a single data layer as input, you use an attribute
with different values ;
- you use iterate the entity selection you will obtain a Feature Class type as output to be connected to the processing model
- you use iterate the records selection you will obtain a Tabular Vue type output to be connected to the processing model
- you use Iterate Field Values you will obtain a Value (text) output to be connected to the processing model
How to iterate the entity selection
The input layer contains 5 hydrographic regions, each one represented by
a polygon . The iterator will create , successively , a class entity containing
one of the polygons , and this entity class will be used as input of the process
For each iteration , the iterator will generate, as well, a string, Value, containing the code for the hydrographic region. This value will be used as an online substitution variable for the output layer of the process model. To this end , we insert % Value% in the layer name at the end of the last tool knew model , for example C: \ Users \ admin \ Documents \ ArcGIS \ Projects \ MyProject10 \ HYDROGRAPHIE_SURFACIQUE_% Value% .shp How to iterate the records selection
The input layer contains 18 hydrographic sectors, each one represented
by a polygon . The iterator will create , successively , a table containing the
records of a single hydrographic region. For the Brittany region, for example,
there are 9 polygons (entities) in the input layer. This table will be used as
input for the processing model, and the statistics will be calculated for the 9
records of Brittany, then , in the other iterations , for each region code present
in the input entity class.
For each iteration , the iterator will, also, generate a string, Value, containing the code for the hydrographic region . This value will be used as an online substitution variable for the output layer of the process model. To this end , we insert % Value% in the layer name at the end of the last tool knew model , for example C: \ Users \ admin \ Documents \ ArcGIS \ Projects \ MyProject10 \ MyProject10.gdb \ SECTEURS_% Value% _Statistics
How to iterate Field Values
The attribute table of the input layer contains a field with values . This
iterator allows creating a series of values that will be used successively as
input for a tool of the processing model, for example for the Buffer tool, the
distance of the buffer.
The iterator reads all records from the input table and according to your
choice , it creates a series of different values or a series comprising all the
values found , even if there are repeated values. This is checked by the
checkbox “Unique Values”.
For example , a table with 100 records has 12 different values.
If the box is checked , the model will run 12 times , once for each of the 12
values . If the box is not checked , the model will run 100 times , once for
each recording .
As the last element in the three parameter windows you can see a check
box “Skip Null Values”. If is possible to find null values (not zero),
it is advisable to check this box because, even though, the iterator will not
have any problem, the processing tools will. When in doubt, check it out, it cannot
hurt, unless the values null are taken in account by the processing model.