ModelBuilder (included with ArcGIS Pro) provides a visual canvas to create geoprocessing models that automate GIS workflows. Invaluable for conducting sophisticated spatial analyses, models are everyday workhorses too. If built with reuse in mind, models can be your go-to shortcuts to get a lot of work done quickly.
In fact, you can think of ModelBuilder as a visual programming language and a model as a workflow map. Like a map:
- A model can be navigated (it has direction built in).
- A model uses shape, color, text, and symbols to represent and communicate about its features.
- A model reveals data relationships that can spark ideas and collaboration.
If you've never created a model in ArcGIS, there's just one thing you need to know to get started: take a five-step approach:
1. Plan the Workflow
Obvious, but...before creating a model, know what you want it to do. List the data input, identify the required geoprocessing tools, and describe the desired output. If the workflow is simple, just think it through in your head.
For more complicated workflows, you may want to sketch everything out on paper or a whiteboard. If you're not sure which tool to use or what a tool's required inputs are, check the geoprocessing tool reference.
2. Create the Model Shell
In ArcGIS, a model is stored inside a toolbox. In ArcGIS Pro, when you create a new project, a toolbox with the same name as the project is automatically created.
- On the Analysis menu, click ModelBuilder to open a model window.
Tip: You can also open a new model by right-clicking the toolbox folder in the Catalog pane and choosing New > Model.
Now set the model properties.
- On the ModelBuilder tab, click Properties.
In the General tab, the option to “Store tool with relative path” should be selected. This is what you want, because using relative paths prevents headaches down the road if your data gets moved around.
Set the properties below, then click OK.
- Name — the filename; no spaces allowed.
- Label — the plain-English name; spaces are fine.
3. Add Tools and Set Parameters
With the basic setup done, now comes the fun part. You can't beat ModelBuilder for easy drag-and-drop building and tinkering. But hang on a sec, you need to understand some ModelBuilder vocabulary.
- A model consists of one or more . A process consists of three : input data, a tool, and the tool's output. Each output becomes input to the next process.
- Just like when you run a geoprocessing tool outside a model, if your input data has selected features or records, the tool processes only the selection.
When you add a tool to a model (by dragging/dropping from the Catalog or Geoprocessing pane), its output element is also added and both elements are colored light gray. In model parlance, gray means "not ready to run." You need to double-click the tool and set its parameters.
- Tip: In a tool dialog box, a red asterisk means the parameter is required.
Once you click OK to set the tool parameters, the input element displays and the process colorizes, Oz-like.
As you add processes, the model window may fill up. Use the Fit to Window and Auto Layout buttons to see the big-picture view and zoom in and out as needed.
Be sure to save periodically as you build the model (ModelBuilder tab > Save).
To add the final model process output as a layer to a map, right-click it and choose Add To Display. Otherwise, you'll have to manually add it to the map.
4. Validate the Model
After you've added all the tools and set their parameters, it's time to ensure the model will run properly. Validation is easy—just click the Validate button on the ModelBuilder tab.
During validation, if there's an error, processing will stop at the first process that requires a fix. Figure out what's wrong and make the fix, then validate again. Repeat if necessary, then save your work.
5. Run the Model
You have two basic options to run a model:
- On the ModelBuilder tab, click the Run button.
- Outside of ModelBuilder, run the model as a tool or service.
Running a model as a tool or service has distinct advantages for collaboration and sharing. We'll cover model tools in an upcoming post.
It's fun to run a model inside ModelBuilder. As the model progresses, each process turns red and then gets a drop shadow. The drop shadow indicates the process has completed correctly. If a process turns gray, that means an error needs to be fixed and the model stops running. If you've validated, this shouldn't happen.
(Optional) 6. Maybe Run It Again
A model's final output may raise a question. For example, suppose a model process created a 50-meter buffer around a feature. After examining the model output, you wonder what would result if you used a 100-meter buffer instead.
To find out, simply open the buffer tool, enter the new distance value, and run the model again starting at the buffer process (right-click the buffer tool and choose Run).
Because you're not altering preceding processes, you don't need to rerun the entire model. This is the beauty of a model. It's a perfect medium to explore and test what-if scenarios.
Like scripts, models are encapsulated workflows. Once built, they can be reused as a fast alternative to manually performing a set of individual processes. You can build a model to automate any geoprocessing task or series of tasks, from the complex to the straightforward.
Now that you've learned the steps to create a simple model, why not try it for yourself?