When building workflows in ArcGIS Pro ModelBuilder, it is common to repeat the same analysis several times. For example, you might want to run the IDW interpolation tool for multiple variables stored in a dataset. A simple approach would be to copy the IDW tool several times in your model and run it separately for each field. While this works, it quickly makes the model larger and harder to manage.
A more efficient approach is to use iterators. Iterators allow ModelBuilder to automatically repeat a process for a list of items—in this case, a set of pollutant fields measured at monitoring stations. This keeps the model clean, efficient, and easier to maintain.
In this tutorial, we will build a ModelBuilder workflow that automatically runs IDW interpolation for several air pollutants recorded at monitoring stations in Mexico City.
Dataset Overview
We will be working with a layer called CAT_Stations_Pollutants. This layer represents air quality monitoring stations. Each station records concentrations of several pollutants stored as numeric fields. The fields we will use include:
- CO
- NO
- NO2
- NOX
- O3
- PM2_5
- PM10
- PMCO
- SO2
All of these fields are numeric Double values, which means they can be used for interpolation.
Step1: Add the Input Dataset to ModelBuilder
Open ModelBuilder and add the dataset: CAT_Stations_Pollutants
This dataset will serve as the input for both the iterator and the interpolation tool.
Step 2: Add the Iterate Fields Tool
Next, add the Iterate Fields tool. Set the following parameters:
- Input Table: CAT_Stations_Pollutants
- Field Type: Double
- Next, select all the pollutants fields (i.e., CO, NO, NO2, NOX, O3, PM2_5, PM10, PMCO, SO2).
- After clicking OK, the iterator appears in the model.
Step 3: Understanding Iterator Outputs
When the iterator is added, two variables appear: Value and Count
Value represents the name of the field currently being processed by the iterator. For example, during one iteration it may represent CO, and during the next it may represent NO2. You can rename this ouput if you wish to for example, FieldName. Count simply tracks how many iterations have occurred.
For this workflow, we only need the Value or FieldName (if you rename this output) variable.
Step 4: Add the IDW Tool
Next, add the IDW tool to the model and connect the Value (or FieldName) variable to the IDW tool and choose Z value field.
What is a Z Value?
The Z value represents the numeric attribute that will be interpolated. In this case, the Z value is the pollutant concentration measured at each monitoring station. For example, if the field being processed is NO2, the IDW tool will use the NO2 measurements from each station to estimate pollution levels across space.
Step 5: Define the Output Raster Name
For the Output Raster, type: IDW_%Value% or IDW_%FieldName%
The percent signs tell ModelBuilder to substitute the variable value during each iteration. For example, the model will automatically produce rasters named:
- IDW_CO
- IDW_NO
- IDW_NO2
- IDW_NOX
- IDW_O3
- IDW_PM2_5
- IDW_PM10
- IDW_PMCO
- IDW_SO2
This ensures each interpolation result is clearly labeled.
Step 6: Set the Environments
Next, click on the Environments tab and make sure the Output Coordinate System is configured. Also, set the Processing Extent to the study area layer (e.g., CDMX_Boundary). This ensures the interpolation is limited to the Mexico City study area. For the Mask, you can use the same study area layer. The mask removes raster cells outside the study boundary. And finally, Click OK to apply the settings.
- Make sure the Output Coordinate System is configured.
- Set the Processing Extent to the study area layer (e.g., CDMX_Boundary). This ensures the interpolation is limited to the Mexico City study area.
- For the Mask, you can use the same study area layer. The mask removes raster cells outside the study boundary.
- Click OK to apply the settings.
Now, why the tool appears gray? At this stage, you may notice that the IDW tool still appears gray in ModelBuilder. This indicates that one required parameter has not yet been defined. The missing parameter is Input Point Features.
Step 7: Connect the Input Dataset
To fix this, connect the same dataset used earlier: CAT_Stations_Pollutants.
Drag it to the IDW tool and select Input Point Features and you will notice that now, the tool has all required inputs.
Step 8: Validate and Run the Model
All we need to do now is to validate the model to ensure that all parameters and connections are correctly configured. Before running the model, you can also right-click the output raster variable and enable Add To Display so that the outputs appear automatically in the map.
When the model runs, ModelBuilder will automatically execute the IDW tool once for each pollutant field. The result will be a series of interpolated raster surfaces representing pollutant concentrations across Mexico City.
Why Use Iterators?
Without an iterator, you would need to run the IDW tool separately for each pollutant field—essentially copying and pasting the tool multiple times.
By using an iterator, ModelBuilder automatically loops through the fields and repeats the analysis for you. This makes the workflow more efficient, easier to maintain, and easier to scale when working with many variables.
See the video below that summarizes the process:
