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 no layers match the parameter criteria, the value of 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 to 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 that will be 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 LayerAnnotation layers will be iterated.
  • Building LayerBuilding layers will be iterated.
  • Building Scene Layer Building scene layers will be iterated.
  • Dimension LayerDimension layers will be iterated.
  • Feature LayerFeature layers will be iterated.
  • Geostatistical Analyst LayerGeostatistical layers will be iterated.
  • Group LayerGroup layers will be iterated.
  • Subtype Group LayerSubtype group layers will be iterated.
  • KML LayerKML layers will be iterated.
  • LAS Dataset LayerLAS dataset layers will be iterated.
  • Mosaic LayerMosaic layers will be iterated.
  • Network Analyst LayerNetwork Analyst layers will be iterated.
  • Network Dataset LayerNetwork dataset layers will be iterated.
  • Parcel LayerParcel layers will be iterated.
  • Raster LayerRaster layers will be iterated.
  • Scene Service LayerScene service layers will be iterated.
  • Table ViewTable views will be iterated.
  • Terrain LayerTerrain layers will be iterated.
  • TIN LayerTIN layers will be iterated.
  • Topology LayerTopology layers will be iterated.
  • Trace Network LayerTrace network layers will be iterated.
  • Utility Network LayerUtility network layers will be iterated.
  • Voxel LayerVoxel layers will be iterated.
String
Workspace Type

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

The Workspace Type parameter is only enabled when the Layer Type parameter is set to Feature Layer, Raster Layer, or Table View.

  • Big Data ConnectionLayers in a big data connection workspace will be iterated.
  • BIM FileLayers in a BIM File workspace will be iterated.
  • CADLayers in a CAD workspace will be iterated.
  • Delimited Text FileLayers in a delimited text file workspace will be iterated.
  • Enterprise GeodatabaseLayers in a enterprise geodatabase workspace will be iterated.
  • Feature ServiceLayers in a feature service workspace will be iterated.
  • File GeodatabaseLayers in a file geodatabase workspace will be iterated.
  • In Memory DatabaseLayers in an in memory database workspace will be iterated.
  • Microsoft ExcelLayers in a Microsoft Excel workspace will be iterated.
  • NetCDFLayers in a NetCDF workspace will be iterated.
  • OLE DBLayers in a OLE DB workspace will be iterated.
  • RasterLayers in a raster workspace will be iterated.
  • ShapefileLayers in a shapefile workspace will be iterated.
  • SQLiteLayers in an SQLite workspace will be iterated.
  • SQL Query LayerLayers in a SQL query layer workspace will be iterated.
  • Stream ServiceLayers in a stream service workspace will be iterated.
  • Web Feature ServiceLayers in a web feature service workspace will be iterated.
String
Feature Type
(Optional)

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

  • AnnotationAnnotation feature classes will be iterated.
  • DimensionDimension feature classes will be iterated.
  • Simple EdgeSimple edge feature classes will be iterated.
  • Complex EdgeComplex edge feature classes will be iterated.
  • Simple JunctionSimple junction feature classes will be iterated.
  • Complex JunctionComplex junction feature classes will be iterated.
  • LineLine feature classes will be iterated.
  • PointPoint feature classes will be iterated.
  • PolygonPolygon feature classes will be iterated.
  • MultipatchMultipatch feature classes will be iterated.
String
Raster Type
(Optional)

The raster format type that will be 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 will be used to filter the layers.

  • AllLayer visibility will not be used to filter layers.
  • VisibleVisible layers will be iterated.
  • Not VisibleNonvisible 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 will be returned if the parameter is set to invalid.

  • AllLayer state will not be used to filter layers.
  • ValidValid layers will be iterated.
  • InvalidInvalid 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