The model diagram is everything you see when you edit a model in ModelBuilder, including the appearance and layout of the tools and variables in the model.
Model elements are the basic building blocks of models. There are four main types of model elements: geoprocessing tools, variables, connectors and groups.
- Geoprocessing tools perform various operations on geographic or tabular data. When tools are added to a model, they become model elements. You can open the tool dialog box of any geoprocessing tool in your model to set the input and output parameters.
- Variables are elements in a model that hold a value or a reference to data. There are two types of variables: data and values.
- Connectors connect data and values to tools. The connector arrows show the direction of processing. There are four types of connectors: data, environment, precondition, and feedback.
The illustration and table below show the different model elements in ModelBuilder.
Data variables are model elements that store paths and other properties of data on disk. Common data variables include feature class, feature layer, raster dataset, and workspace.
Derived or output data variable
Derived or output data is new data created by a tool in the model. When a geoprocessing tool is added to a model, variables for the tool's output parameters are automatically created and connected to the tool.
Value variables are values such as strings, numbers, Boolean (true/false values), spatial references, linear units, or extents. Value variables contain anything but references to layers or data stored on disk.
Derived value variable
Values that are the result of a tool. Derived values can be inputs to other tools. The Calculate Value tool, for example, outputs the result of a logical or mathematical calculation.
Tools are geoprocessing tools added to the model. These include all tools you will find in a system toolbox as well as custom model and script tools. Tools in ModelBuilder also include special tools such as iterators, ModelBuilder utilities, and ModelBuilder logical tools.
Groups are visual categories that include other elements in the model. These groups can be expanded and collapsed. Learn more about Grouping
Geoprocessing environment settings are additional settings that affect geoprocessing tools. These settings provide a powerful way to ensure geoprocessing is performed in a controlled environment where you decide things such as the processing extent that limits processing to a specific geographic area or a coordinate system for all output geodatasets.
There are three levels of environment settings that apply to ModelBuilder:
- Project-level environments are the settings that will be applied to any tool when it is executed in the current project. These environment settings are saved with the project.
- Model-level settings are specified and saved with a model and override project-level settings.
- Model process-level environments are applied to a single run of a tool, saved with the model, and override the project and model-level settings.
There are four workspace environments that can be used in ModelBuilder to simplify model data management.
- Scratch GDB
The Scratch GDB environment setting is the location of a file geodatabase you can use to write temporary data.
The scratch GDB (geodatabase) is the preferred location for writing intermediate outputs in a model. Use this geodatabase by specifying an output dataset path such as %scratchgdb%\output.
- Scratch folder
The Scratch Folder environment setting is the location of a folder you can use to write file-based data, such as shapefiles, text files, and layer files. It is a read-only environment managed by ArcGIS.
- Current workspace
Tools that honor the Current Workspace environment setting use the workspace specified as the default location for geoprocessing tool inputs and outputs.
- Scratch workspace
Tools that honor the Scratch Workspace environment setting use the specified location as the default workspace for output datasets.
In addition to the above workspaces, you can also write model outputs to memory. Data written to memory is temporary and automatically cleared when the application closes.
You can use the output of a process as an input to a previous process. This is known as feedback, since you feed the output back to the input.
In-line variable substitution
Contents of a variable can be used as a substitute for another variable by enclosing the substituting variable in percent signs (%). For example, if you have a model variable Category that references a value Desert, and you wish to use that value as input to a geoprocessing tool, specify the tool input as %Category%.
Iterators and iteration
Iteration, or looping, refers to an automated way to repeat a process. Iteration is very important because automating repetitive tasks reduces the time and effort required to perform the tasks. With iteration in ModelBuilder, a process can be executed over and over using different settings or data each time.
A ModelBuilder model is saved as a model tool in a toolbox. A model tool is just like any other geoprocessing tool: it can be run, used in Python, or added to another model. To edit the model tool in ModelBuilder, right-click and select Edit. To open and run the model tool in the Geoprocessing pane, double-click it or right-click and select Open.
The elements in a model can be arranged by moving the elements to the desired location or auto-arranged using the AutoLayout button on the ModelBuilder ribbon. To auto-arrange the elements inside the group, right click the group and click the AutoLayout from the context menu. To lock/unlock the elements click the Lock Element/Unlock Element button under the View group on the ModelBuilder ribbon. Locked elements are not affected by the AutoLayout in the model.
Model parameters are the parameters that appear when the model is opened as a geoprocessing tool. Any variable in the model can be made a model parameter. Derived variables (tool outputs) that are a parameter will be added to the last active map after they are successfully created.
Preconditions can be used to explicitly control the order of operations in a model. For example, a process can be made to run after another process by making the output of the first process a precondition to the second process. Any variable can be made a precondition to tool execution, and any tool can have more than one precondition.
Processes and state
A model process consists of a tool and all variables connected to it. Connector lines indicate the sequence of processing. Many processes can be chained together to create a larger process. A process in a model can be in one of four states: not ready to run, ready to run, running, and has been run.
Not ready to run
When you initially drag a tool into ModelBuilder, the process is in a not-ready-to-run state because the required parameter values have not been specified. The tool and its inputs and outputs are gray.
Ready to run
A process is ready to run when the tool has all required parameter filled in. All model elements in the process have color.
The process is in a running state if the model tools show red color.
Has been run
If you run the model from within ModelBuilder, the tool and derived data elements are displayed with drop shadows, indicating that the process has run and the derived data has been generated.
ModelBuilder provides a number of support utilities, including Calculate Value, Collect Values, Get Field Value, Parse Path, and Select Data.
Model validation refers to the process of making sure all model variables (data or values) are valid.