Play It Again
Using geoprocessing tools in batch mode
By Monica Pratt, ArcUser Editor
This article as a PDF.
This article as a PDF.
When adding data sources, save time by browsing to the location and choosing multiple datasets by holding the CTRL key.
Do you have to run the same geoprocessing tool against many datasets? Perhaps you need to convert a bunch of shapefiles to file geodatabase feature classes, clip the spatial extents of some feature classes to the extent of an area of interest, or apply a specific projection to several feature classes. ArcGIS has a faster way to get this done: batch mode.
Using a geoprocessing tool in batch mode speeds repetitive processes by allowing you to specify multiple data sources and different parameters for each data source in a single operation. If background processing is enabled, you can do other things while ArcGIS executes the tool as many times as needed. Although batch mode capability has been available for some time, many users don't know this or forget to employ batch mode.
One Click Away
You can access a geoprocessing tool's batch mode from ArcCatalog or from the Catalog window in ArcMap simply by right-clicking the tool you want to use and choosing Batch from the context menu. The batch dialog box containing the grid for that tool opens. Each line in the grid represents the data and tool parameters for a single process. To more easily read the contents of each cell in the grid, you can resize the dialog box by stretching it and grid columns by dragging the column separators.
You use the grid to add two types of items: data and values. Data includes the location of the shapefiles, feature layers, tables, TINs, rasters, networks, or other files that will be processed. Values are the strings and integers that stipulate how the tool will operate.
Before running a batch process, verify the data and values entered using Check Values.
More Ways to Streamline
There are several ways to insert data and values in the grid besides just clicking in a cell and typing. Use shortcuts in combination to reduce the number of keystrokes and clicks needed to add all the information the tool needs to run.
For some parameters, the tool dialog box can be useful. Access it by right-clicking in the cell and choosing Open or (quicker) double-clicking in the cell. Clicking OK returns you to the grid.
When adding a data source, typing the long path name to it is a tedious and error-prone task. Browsing and dragging are more efficient methods for inputting data sources. With the tool's batch grid open, right-click in the cell that will hold a data source parameter and choose Browse. Navigate to the location of the data source. To save time, you can choose multiple datasets by holding the CTRL key. (However, don't use this shortcut for tools like the Union tool that expect multiple datasets.) Alternatively, you can drag each data source file from Catalog to a grid cell.
The grid accepts values copied to and pasted from the system clipboard. You can use the classic CTRL+C and CTRL+V to accomplish this or the Copy and Paste commands available from the batch grid context menu.
Make sure all the iterations of the batch process have run correctly by checking the Results window.
To fill several cells with the same value, right-click the cell with the desired value and choose Fill to copy that value to all the cells in the column below. To copy the value to only specific cells, select the processes containing those cells first, then use Fill to copy the value to just those selected cells. To remove values from a column of cells, right-click the topmost cell and choose Clear. The values in all the cells below it will be removed. To remove the content of only specific fields, select the processes containing those cells first, right-click the first cell, and choose Clear to remove values in just those selected cells.
The buttons on the right side of the grid modify tool execution. Add or delete processes in the grid using the Plus and Delete buttons and rearrange the order in which processes execute using the Up and Down arrows. To make the best use of your time, enable background processing. This can be done in either ArcMap or ArcCatalog by choosing Geoprocessing > Geoprocessing Options from the Standard toolbar and checking the box to enable it.
Before Running the Tool
Because the batch grid does not perform error checking, the last step before running a batch process should be to perform value checking to ensure that you have not accidentally entered an incorrect string or a dataset that doesn't exist or have an output dataset with no name. Click the the Check Values button—the one with the check mark icon. In addition to scanning all the rows in the grid for errors, it will also create an output dataset name (if none has been specified). A white cell means the parameter is correct. Error messages are color coded. Table 1 provides an explanation of each code.
Table 1: Check Values error messages
|Green||Required parameter is missing and a value must be supplied.|
|Red||Error: Process will not execute.|
|Yellow||Warning: Output exists but results may not be what you expect.|
|Gray||Unavailable: Parameter has no use given values of other parameters.|
The Final Step
To make sure all the iterations of your batch process have run correctly, check the Results window. Choose Geoprocessing > Results to view inputs, environments, and messages for geoprocessing sessions run from the tool dialog box or in batch mode. Remember these tips the next time you need to perform geoprocessing operations on more than just a couple of files. Batch mode can help you make better use of your valuable time.