Skip To Content

Batch geoprocessing

Geoprocessing tools can be run in a batch mode that allows you to run the tool multiple times using many input datasets or different parameter settings. This makes it possible to run a given tool as many times as needed with very little interaction. For example, you can run the Clip tool in batch mode to clip several layers to the same study area.

Batch clip
The Batch Clip tool is used to clip multiple input layers to the same study area.

A batch is defined as a number of iterations of a given tool. One of the selected tool's parameters drives the batch and changes per iteration while the remaining tool parameters are constant for all iterations in the batch. In the example above, the batch will have three iterations in which the Clip tool is run. Each iteration uses one of the layers in the Batch Input Features parameter, and all other parameters remain the same across the iterations.

Batch mode

Note:

Not all geoprocessing tools support batch mode. Most notably, tools that process multiple input datasets, such as Intersect and Merge, and tools that create map layers, such as Make Feature Layer and Make Raster Layer, do not support batch mode.

To open a tool in batch mode, do the following:

  1. Find the geoprocessing tool you want to use.
  2. Right-click the tool and select Batch. If the Batch command is disabled the tool does not support batch mode.
  3. Before using batch mode, you must first select the parameter to drive the batch process. The list of parameters from which you can select only includes input parameters.

    For example, to buffer several feature classes by the same distance, select the Buffer tool's Input Features parameter for the batch process.

    Some input parameters are not supported, including all parameters of type Boolean (check boxes), Field Map, and Value Table.

  4. Optionally, choose whether the batch tool should be saved or temporary. If you choose to save it, you can specify the new batch tool name and the location where it will be saved.

    The batch tool is a new model tool that is created automatically and uses a ModelBuilder iterator to perform batch processing.

  5. Click Create.

After completing the steps above, a batch version of the geoprocessing tool will open in the Geoprocessing pane, and you can now specify the tool parameters and run it.

Run a batch tool

The parameters displayed on the batch tool will closely match the normal version of the tool. One important difference is that the parameter you selected to drive your batch process will now have a Batch prefix on the parameter label and will support specifying multiple values. Each value that you enter for this batch parameter will result in an additional iteration of the tool to run within the batch.

For example, to add a field with the same name and type to six tables, do the following:

  1. Right-click the Add Field tool and select Batch.
  2. Select Input Table as the batch parameter and click Create.
  3. When the Batch Add Field tool opens, browse to and select the six tables for the Batch Input Table parameter.
  4. Run the Batch Add Field tool.

Add Field and Batch Add Field tools
The Add Field tool, on the left, only supports one input table. Conversely, the Batch Add Field tool, on the right, supports multiple input tables.
Note:

Because a batch geoprocessing tool can potentially create a large number of new output datasets, the outputs of a batch tool are not automatically added to a map. When the batch tool has finished, you can view the outputs in the Catalog pane and manually add them to a map.

Dynamic output naming

Another important difference between the normal version and the batch version of a tool is the critical use of the %Name% variable. This variable allows you to dynamically name the outputs of the batch tool using the values in the batch parameter. The %Name% variable is defined in the batch model tool using in-line variable substitution. The variable is replaced by the value in the batch parameter during each iteration. If the value in the batch parameter contains spaces or special characters, they are replaced with an underscore. If the value is a path to a dataset, only the dataset name is used.

The %Name% variable is automatically added to the batch tool's required output parameters and can be manually specified for other parameters that should use dynamic naming.

Note:

If you do not use the %Name% variable in the output data path, the same path is used for each iteration, and each iteration overwrites the output of the previous iteration. This does not apply to tools that update or modify the input dataset.

For example, if a batch tool's output is set to %Name%_stats, and the Batch Input Table parameter contains tables named City, County, and State, the batch tool will create three outputs, each named after one of the inputs: City_stats, County_stats, and State_stats.

Use of the %Name% variable

The following additional variables may be useful in dynamically specifying a parameter value and can be used similarly to the %Name% variable:

  • %Workspace Name%—The workspace or folder name of the data in the batch parameter.
  • %Path%—The catalog location of the data in the batch parameter, not including the data name or extension.
  • %Extension%—The extension of the data in the batch parameter.

Add additional tools to the batch

Since the batch tools you open are model tools, they can be extended with additional tools to perform a chain of processing steps. If you want to extend your batch model, select the Save the batch tool option so the model is saved in a location where you can find and edit it.

For example, if you started by opening the Add Field tool in batch mode, you may want to extend the Batch Add Field model with the Calculate Field tool so the model first adds a field to a number of datasets, then calculates that field.

Learn more about adding tools to a model