Iterate Layers (ModelBuilder)

Summary

Iterates layers in a map.

Learn how Iterate Layers works in ModelBuilder

Usage

  • This tool is intended for use in ModelBuilder, not in Python scripting.

  • When the Layer Type parameter is set to Table View, only stand-alone tables are iterated. To work with feature or raster tables, set the Layer Type parameter to Feature Layer or Raster Layer, respectively.

  • For each iteration, the tool returns the following outputs:

    • Output Layer—The layer from the map based on the parameter filters that have been set. This layer will include any selections or joins already set on the layer.
    • Name—The name of the layer. The name can be used in inline variable substitution.
    • Output Layer Type—The type of layer. This value matches the layer types set with the Layer Type parameter. The output values are constants and are not localized. If two or more layer types are used, the type can be used to branch a model as shown below:
      Example of using the layer type derived output
    • Workspace or Format Type—The workspace type of the layer. This value is only returned for feature layers, raster layers, and table views. The output values are constants and are not localized. For raster layers that are stored in the folder-based workspace, the file format is returned—for example TIFF—and this value can be used to branch a model or as a diagnostic to evaluate the layer type that was iterated.
      Example of using the workspace type derived output

  • The tool returns layers that match the type set with the Layer Type parameter and the filters set with the Visibility and State parameters. For example, if the Layer Type parameter is set to Feature Layer and Raster Layer, the Visibilty parameter to Not Visible, and the State parameter to Valid, the tool will return feature and raster layers that are both not visible and valid.

  • If the Layer Type parameter is not set or there are no layers that match the parameter criteria, the value of the Output Layer is set to OUTPUT_LAYER, the value of the Name, and the Output Layer Type outputs are set to FEATURE_LAYER, and the Workspace or Format Type output is set to WORKSPACE.

  • The Layer Type parameter can be set to multiple types, for example Feature Layer, Raster Layer, and Table View. However, the tool can be connected to downstream tools such as Copy Features, Copy Raster, or Copy Rows that may be incompatible with some of the layer types. To support multiple layer types in this scenario, the Layer Type parameter must be set to a single specific layer type. Then connect the output to the corresponding tool that works with that specific data type. Once all the downstream connections are made, you can set the Layer Type parameter to all three layer types. This workflow is necessary because the starting default for the tool is set to a feature layer type that is not compatible with the tools that take raster as input. Once all layer types are added the model, validation leaves the tools in their valid state.

Parameters

LabelExplanationData Type
Input Map

The input map with the layers to iterate.

Map
Wildcard
(Optional)

A combination of * and characters that help to limit the results. The asterisk is the same as saying ALL. If no wildcard is specified, all inputs will be returned. For example, it can be used to restrict Iteration over input names starting with a certain character or word (for example, A* or Ari* or Land* and so on).

String
Layer Type
(Optional)

Specifies the layer type used to filter the layers. If a layer type is not specified, all supported layer types will be iterated. More than one layer type can be used to filter the layers.

  • Annotation Layer —Annotation layers will be iterated.
  • Building Layer —Building layers will be iterated.
  • Building Scene Layer — Building scene layers will be iterated.
  • Dimension Layer —Dimension layers will be iterated.
  • Feature Layer —Feature layers will be iterated.
  • Geostatistical Analyst Layer —Geostatistical layers will be iterated.
  • Group Layer —Group layers will be iterated.
  • Subtype Group Layer —Subtype group layers will be iterated.
  • KML Layer —KML layers will be iterated.
  • LAS Dataset Layer —LAS dataset layers will be iterated.
  • Mosaic Layer —Mosaic layers will be iterated.
  • Network Analyst Layer —Network Analyst layers will be iterated.
  • Network Dataset Layer —Network dataset layers will be iterated.
  • Parcel Layer —Parcel layers will be iterated.
  • Raster Layer —Raster layers will be iterated.
  • Scene Service Layer —Scene service layers will be iterated.
  • Table View —Table views will be iterated.
  • Terrain Layer —Terrain layers will be iterated.
  • TIN Layer —TIN layers will be iterated.
  • Topology Layer —Topology layers will be iterated.
  • Trace Network Layer —Trace network layers will be iterated.
  • Utility Network Layer —Utility network layers will be iterated.
  • Voxel Layer —Voxel layers will be iterated.
String
Workspace Type

Specifies the workspace type used to filter the layers. If a workspace type is not specified, all layers of the supported workspace types will be iterated.

  • Big Data Connection —Layers in a big data connection workspace will be iterated.
  • BIM File —Layers in a BIM File workspace will be iterated.
  • CAD —Layers in a CAD workspace will be iterated.
  • Delimited Text File —Layers in a delimited text file workspace will be iterated.
  • Enterprise Geodatabase —Layers in a enterprise geodatabase workspace will be iterated.
  • Feature Service —Layers in a feature service workspace will be iterated.
  • File Geodatabase —Layers in a file geodatabase workspace will be iterated.
  • In Memory Database —Layers in an in memory database workspace will be iterated.
  • Microsoft Excel —Layers in a Microsoft Excel workspace will be iterated.
  • NetCDF —Layers in a NetCDF workspace will be iterated.
  • OLE DB —Layers in a OLE DB workspace will be iterated.
  • Shapefile —Layers in a shapefile workspace will be iterated.
  • Raster —Layers in a raster workspace will be iterated.
  • SQLite —Layers in an SQLite workspace will be iterated.
  • SQL Query Layer —Layers in a SQL query layer workspace will be iterated.
  • Stream Service —Layers in a stream service workspace will be iterated.
  • Web Feature Service —Layers in a web feature service workspace will be iterated.
String
Feature Type
(Optional)

Specifies the feature type used to filter the layers. If a feature type is not specified, all supported feature types will be iterated.

  • Annotation —Annotation feature classes will be iterated.
  • Dimension —Dimension feature classes will be iterated.
  • Simple Edge —Simple edge feature classes will be iterated.
  • Complex Edge —Complex edge feature classes will be iterated.
  • Simple Junction —Simple junction feature classes will be iterated.
  • Complex Junction —Complex junction feature classes will be iterated.
  • Line —Line feature classes will be iterated.
  • Point —Point feature classes will be iterated.
  • Polygon —Polygon feature classes will be iterated.
  • Multipatch —Multipatch feature classes will be iterated.
String
Raster Type
(Optional)

The raster format type used to filter the raster layers when the Workspace Type parameter is set to Raster. If a raster type is not specified, all layers of the supported raster types will be iterated.

String
Visibility
(Optional)

Specifies whether layer visibility is used to filter the layers. If layer visibility is not specified, all layers will be iterated.

  • Visible —Layer visibility will be used to filter the layers and visible layers will be iterated.
  • Not Visible —Layer visibility will not be used to filter the layers and nonvisible layers will be iterated.
String
State
(Optional)

Specifies the layer state that will be used to filter the layers. Layers with broken source path layers are returned if the parameter is set to invalid. If a layer state is not specified, all layers will be iterated.

  • Valid —Valid layers will be iterated.
  • Invalid —Invalid layers will be iterated.
String
Recursive
(Optional)

Specifies whether the iterator will iterate nested group layers.

  • Checked—Nested group layers will be iterated.
  • Unchecked—Nested group layers will not be iterated.
Boolean

Derived Output

LabelExplanationData Type
Output Layer

The layer from the map based on the parameter filters that have been set. This layer will include any selections or joins already set on the layer.

Any Value
Name

The name of the layer.

String
Output Layer Type

The type of layer.

String
Workspace or Format Type

The workspace type of the layer.

String

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes