A model is a visual representation of a workflow in which several geoprocessing tools are run in sequence. The output from one tool is often the input to another tool. A geoprocessing model depicts a workflow as a diagram. It also runs the workflow it depicts. You can use models for many purposes, such as the following:
- Automating repetitive tasks
- Exploring alternative outcomes with different datasets and tool parameters
- Visually documenting your geoprocessing methodology
- Incrementally developing and improving workflows
- Sharing knowledge and best practices with colleagues
Overview
- Video length: 10:32.
- This video was created with ArcGIS Pro 3.2.
In this tutorial, you'll build and run a geoprocessing model. Your model will automate the analysis workflow from the Use geoprocessing tools quick-start tutorial. This tutorial assumes that you are familiar with that workflow.
- Estimated time: 45 minutes
- Software requirements: ArcGIS Pro Basic
Note:
The quick-start tutorials are updated at each software release. For the best experience, use an online help version that matches your software version.
Open the project
In New Zealand, pastureland for grazing livestock is threatened by various invasive grass species. These grasses are primarily spread through natural means, such as wind-blown seeds, but also through human contact. In the Use geoprocessing tools tutorial, you analyzed the proximity of one invasive grass species (Nassella tussock) to one potential source of human contact (commercial campgrounds).
In this tutorial, you'll build a geoprocessing model that allows you to apply the same analysis to other invasive grass species and other points of human contact.
- Start ArcGIS Pro and sign in if necessary.
- On the start page, next to the list of recent projects, click Open another project.
Note:
If you already have a project open, click the Project tab on the ribbon. In the list of side tabs, click Open. On the Open page, click Open another project at the top of the page.
- On the Open Project dialog box, under Portal , click ArcGIS Online .
Note:
If you are signed in to ArcGIS Enterprise , you must set your active portal to ArcGIS Online to access the tutorial data. If you can't do this, you can download the data from a browser.
- At the top of the dialog box, in the Search box, type Make a geoprocessing model and press the Enter key.
- In the list of search results, click Make a geoprocessing model to select the project package.
Note:
If there is more than one project package with this name, select the package with the Authoritative badge . In the Owner column, the owner name is ArcGISProTutorials. If you don't get any results, see No search results are returned.
- Click OK.
The project opens to a view of the Marlborough region of New Zealand. Commercial campgrounds are displayed along with the known range of Nassella tussock.
- On the ribbon, click the View tab. In the Windows group, click Reset Panes and click Reset Panes for Mapping (Default).
This ensures that the Contents and Catalog panes are open and that other panes are closed.
Create a model and add a process
The map contains several layers representing locations where people may come into contact with invasive grasses: commercial campgrounds, campsites, trails, roads, and populated places. The map also contains layers representing four invasive grass species: Nassella tussock, White-edged nightshade, Kangaroo grass, and Chilean needle grass.
The invasive species layers represent boundaries within which a given plant has been found. They do not represent the density of the plant at a given location. A marked area may be heavily infested or may have only scattered plants.
You'll create a model and add a process to it. A process is a geoprocessing tool connected to its input and output data. A model with one process is the simplest model that can be run.
- On the ribbon, click the Analysis tab. In the Geoprocessing group, click ModelBuilder .
An empty model view opens in the project. On the ribbon, the ModelBuilder tab appears. A toolbar also can be expanded above the model view that includes commonly used tools to increase efficiency in ModelBuilder workflows.
Note:
The ModelBuilder toolbar includes the most popular tools from the ModelBuilder tab. For less common operations, you may need to use the ribbon tab. For this tutorial we will mostly use the toolbar.
- Click Show Toolbar in the top-right of the model view to expand the toolbar.
- From the Contents pane, drag the Commercial Campgrounds layer into the model view.
A blue oval element with selection handles is added to the model. This shade of blue represents input data.
- In the model view, right-click the Commercial Campgrounds element and click Open.
The dialog box allows you to change the input value to another map layer from the drop-down menu. You can also browse to another dataset. For this reason, the element is called an input data variable.
Tip:
Double-clicking the model element also opens its properties dialog box.
- Click OK on the Commercial Campgrounds dialog box.
- On the ModelBuilder toolbar, click Tools . (Click the icon, not the drop-down arrow.)
The Geoprocessing pane appears.
- In the Geoprocessing pane, in the search box, type Pairwise Buffer.
The Pairwise Buffer tool appears at the top of the list of search results.
- Drag the Pairwise Buffer tool from the Geoprocessing pane to the model view.
A gray rectangle representing the tool is added to the model view. It is automatically connected to an oval output data element. Every geoprocessing tool you add to a model has an output data element. The output may be either a new dataset, as with the Pairwise Buffer tool, or an updated version of the input dataset. (For example, the Add Field tool adds a new field to an existing table.)
The gray color of the tool means that it is not yet ready to run. It must be connected to input data, and its tool parameters must be set.
Tip:
When you add a new element to a model, it is selected by default. Selected elements can be dragged to new positions. To deselect an element, click some empty space in the view. To select an element, click it or draw a box around it.
- Hover over the Commercial Campgrounds input data variable. Click and drag to draw a connector line to the Pairwise Buffer tool element. Release the mouse button and click Input Features on the pop-up menu.
The Commercial Campgrounds layer is specified as the input data to the Pairwise Buffer tool. The process is not yet ready to run because a buffer distance must be set.
- Right-click the Pairwise Buffer tool element and click Open.
The Pairwise Buffer tool dialog box appears. Some of its parameters are blank; others have default values. Required parameters are marked with a red asterisk.
- On the Pairwise Buffer dialog box, for Distance [value or field], type 5. Change the units from Unknown to Kilometers.
- Click OK.
All the elements are colored, which means that the process is ready to run.
- Right-click the green output data variable, CommercialCamp_PairwiseBuffe, and click Add To Display.
This ensures that the output data will be added to the Contents pane as a map layer.
Run the model from the model view
This model will draw 5-kilometer buffers around commercial campgrounds. That's not your ultimate goal, but you'll run the model now to confirm that it works as expected. When the model runs, the Pairwise Buffer tool element will turn red as it processes the input data.
- On the ModelBuilder toolbar, click Run .
When the model finishes running, a message informs you that the model ran successfully.
- Close the Model message box.
- Make the Marlborough map view active.
Five-kilometer buffers are drawn around the commercial campgrounds. This was just a test run of the model, so you'll remove the buffer layer and its source data.
- In the Contents pane, right-click the ModelBuilder group layer (which contains the buffer layer) and click Remove .
- In the Catalog pane, expand the Databases container and expand Make_a_geoprocessing_model.gdb.
The output data, CommercialCamp_PairwiseBuffe, has been written to the project's default geodatabase. You can send model output data to its own geodatabase to keep it separate from other datasets. You'll change the location of the model output data later in the tutorial.
- In the geodatabase, right-click CommercialCamp_PairwiseBuffe and click Delete . On the Delete prompt, click Yes.
- Make the model view active.
The tool and its output data variable now have drop shadows. This means that the process has already been run. To prepare the model to run again, you validate it.
- On the ModelBuilder toolbar, click Validate .
The drop shadows are removed and the model is ready to run. Before continuing, you'll name the model and save it.
- On the ModelBuilder toolbar, click Properties .
- On the Tool Properties dialog box, on the General tab, change the Name to SummarizeInvasiveSpecies.
- Change the Label to Summarize Invasive Species.
The label—not the name—will be displayed in ArcGIS Pro. Model names can't include spaces, underscores, or special characters; labels can be formatted more readably.
- Click OK.
- On the ModelBuilder toolbar, click Save .
Note:
Saving the model doesn't save the project, nor does saving the project save the model. However, if you attempt to exit ArcGIS Pro with an unsaved model, you'll be prompted to save it. Unsaved model changes are not recovered by project backups.
Configure the model as a geoprocessing tool
As you have seen, a model can be run from the model view. A model can also be run as a geoprocessing tool. This is a more common and convenient way to run a model.
- In the Catalog pane, expand the Toolboxes container and expand Make_a_geoprocessing_model.tbx.
When you saved the model, a model tool was created in the default toolbox.
Tip:
You can create a model directly from a toolbox by right-clicking the toolbox and clicking New > Model.
- In the Catalog pane, right-click the Summarize Invasive Species model and click Open.
The model opens as a geoprocessing tool. You could run it now from the Geoprocessing pane and it would produce the same output as running it from the model view. However, a geoprocessing tool isn't very useful until it has parameters that can be set by the user.
Tip:
You can double-click a model tool in the Catalog pane to open it. Alternatively, you can click the Open Tool button on the ModelBuilder tab on the ribbon.
- Make the model view active.
The model view is now called Summarize Invasive Species.
- Right-click the Commercial Campgrounds input data variable and click Parameter.
The letter P (for parameter) appears next to the input data variable. This means that the variable has been set as a parameter in the model geoprocessing tool.
- On the ModelBuilder toolbar, click Save .
- In the Catalog pane, double-click the Summarize Invasive Species model.
In the Geoprocessing pane, the tool updates with its new parameter.
Tip:
You need to reopen the tool to refresh its display, even if the tool is already open in the Geoprocessing pane.
The tool parameter name, Commercial Campgrounds, comes from the name of the input data variable. You'll change it to something more general. This parameter allows you to choose any layer that represents a point of contact with invasive grasses.
You'll also set a second model parameter that allows you to choose a buffer distance and units. You can leave the Geoprocessing pane open as you edit the model.
- Make the model view active. Right-click the Commercial Campgrounds input data variable and click Rename. In the edit box, change the name to Human Contact Locations. Press the Enter key.
This changes the variable name in the model. The corresponding parameter name in the geoprocessing tool will also be updated after you save your changes and reopen the tool.
- Right-click the Pairwise Buffer tool element and click Create Variable > From Parameter > Distance [value or field].
The new element is represented with a different shade of blue to show that it's a value variable, not a data variable.
- If necessary, drag the selected Distance [value or field] variable to a location that doesn't cover another model element.
- Right-click the Distance [value or field] variable and click Parameter. Click empty space in the model view to deselect the variable.
- Right-click the Distance [value or field] value variable and click Rename. In the edit box, change the name to Buffer Distance. Press the Enter key.
You'll also rename the green output data variable, but you won't set it as a model parameter. This output will later be connected as an input to the Summarize Within tool.
Note:
Output data that becomes the input to another process is called intermediate data. When you run the model as a geoprocessing tool, intermediate data is automatically deleted unless you set the data variable as a model parameter or specify that you want to keep the data. In this case, you don't need to keep the intermediate data.
- Right-click the CommercialCamp_PairwiseBuffe output data variable and click Rename. Change the name to Contact Location Buffers and press the Enter key.
- On the ModelBuilder toolbar, click Save .
- In the Catalog pane, in the Make_a_geoprocessing_model toolbox, double-click the Summarize Invasive Species tool.
The tool parameter names match the model variable names.
Next, you'll clear the default values from the geoprocessing tool parameters because these values don't represent expected user settings.
- Make the model view active. Right-click the Human Contact Locations data variable and click Open.
- Highlight the default value of Commercial Campgrounds and press the Delete key. Click OK.
The model process turns gray (not ready to run) because you have just removed the input value to the Pairwise Buffer tool. This is expected. The model can't be run from the model view in this state, but it can still be run as a geoprocessing tool when you fill in the parameters.
- Right-click the Buffer Distance value variable and click Open.
- Highlight the default distance value of 5 and press the Delete key. Click OK.
All the model elements are now gray.
- On the ModelBuilder toolbar, click Save .
- In the Catalog pane, double-click the Summarize Invasive Species tool.
Both tool parameters are now blank. They also have red asterisks to indicate that they are required parameters. Notice that deleting the Buffer Distance value also reset the distance units from kilometers to Unknown.
Finish building the model
To finish building the model, you'll add an input data variable representing invasive species and you'll add the Summarize Within tool. You'll connect input variables to tools and set model parameters.
Previously, you created an input data variable by dragging a layer from the Contents pane to the model view. This time, you'll create a variable from the ModelBuilder toolbar.
- Make the model view active. On the ModelBuilder toolbar, click Variable .
- On the Variable Data Type dialog box, click the drop-down arrow and click Feature Layer. (You will need to scroll up in the list.) Click OK.
- Drag the selected variable to an empty part of the model.
- Rename the Feature Layer data variable to Invasive Species.
- Make the Invasive Species data variable a model parameter.
When you run the model as a geoprocessing tool, you can choose which invasive species to analyze.
- On the ModelBuilder toolbar, click Tools .
- In the Geoprocessing pane, in the search box, type Summarize Within.
The tool appears in the list of search results.
Your search results may include two or more Summarize Within tools in different toolboxes. Use the Summarize Within tool from the Analysis Tools toolbox, as shown in the image above.
Tip:
Use Display tools with descriptions and Display tools as a list at the bottom of the Geoprocessing pane to change the tool display.
- Drag the Summarize Within tool from the Geoprocessing pane to the model view.
Tip:
If you accidentally open the Summarize Within tool in the Geoprocessing pane, click Back to return to the list of search results.
The Summarize Within tool requires two inputs. One is the layer of features to be summarized, which is Invasive Species. The other is the layer of zones within which invasive species are analyzed, which is Contact Location Buffers.
The Output Grouped Table data variable is an optional output of the Summarize Within tool. It isn't used in this analysis.
- Hover over the Invasive Species data variable. Drag a connector line to the Summarize Within tool. Release the mouse button and click Input Summary Features on the pop-up menu.
Tip:
If you accidentally make the wrong choice on the pop-up menu, click the connector line to select it. Delete the connector line and draw a new one.
- Connect the Contact Location Buffers data variable to the Summarize Within tool as Input Polygons.
You'll adjust the model layout later in this section.
- Right-click the Output Feature Class data variable and click Parameter.
Setting this variable as a model parameter allows you to name the output feature class and change the output location when you run the tool.
- Right-click the Output Feature Class data variable again and click Open.
- Highlight the entire Output Feature Class path and press the Delete key. Click OK.
- Right-click the Summarize Within tool and click Create Variable > From Parameter > Shape Unit.
- Drag the selected variable to an empty part of the model, if necessary.
- Rename the Shape Unit value variable to Area Unit of Measure.
This parameter allows you to choose the measurement units, such as hectares, in which to summarize the area covered by the invasive species.
- Right-click the Area Unit of Measure variable and click Open.
- On the Area Unit of Measure dialog box, click the drop-down arrow and click Hectares. Click OK.
This sets the default measurement unit to hectares.
- Make the Area Unit of Measure variable a model parameter.
- Deselect the Area Unit of Measure variable.
- On the ModelBuilder tab, in the View group, click Auto Layout .
Your model layout may look different, but the tool processing order should have the same left-to-right sequence.
- Optionally, select model elements and drag them to positions you like better.
Tip:
To reshape a connector, click the connector. Vertices appear at each end of the line. Click the connector again and drag it. A new vertex appears and allows you to reshape the connector. You can add more vertices in the same way. To return the connector to its original shape, right-click the connector and click Route Link(s) .
The Diagram contextual tab on the ribbon has options to modify the model's orientation, spacing, connectors, text properties, and more. For more information, see Model diagram appearance.
- On the ModelBuilder toolbar, click Save to save the model.
- In the Catalog pane, double-click the Summarize Invasive Species tool.
The tool is ready to use. Its design can be improved by making Output Feature Class the last parameter. You'll change the parameter order in the next section.
The model diagram is finished. The model doesn't capture the entire analysis workflow from the Use geoprocessing tools tutorial. The Select Layer by Location tool has been left out to simplify the workflow. Therefore, every input feature from the Contact Location Buffers layer will be summarized in the output dataset, whether or not it contains an invasive species. Many output features may have summary values of 0.
Set model properties and environments
Before running the model, you'll reorder the parameters on the geoprocessing tool. You'll also set default symbology for the model output. Finally, you'll save the model output to its own geodatabase.
- On the ModelBuilder toolbar, click Properties .
- On the Tool Properties dialog box, click the Parameters tab.
The top-to-bottom order of parameters on the Tool Properties dialog box matches the order in which the parameters appear on the geoprocessing tool. This order reflects the sequence in which you set the variables as model parameters.
- In the last row of the table, click the row header (the gray box containing the numeral 4).
The row representing the Area Unit of Measure parameter is selected.
- Drag the selected parameter up one position above the Output Feature Class parameter.
As you drag the parameter, its position is represented by a horizontal gray line.
- Scroll across the parameter table to see more columns.
The last column allows you to assign symbology to model datasets using a layer file (.lyrx). A layer file stores display properties of a layer, such as symbology and labeling, without storing spatial coordinates or attributes. In this case, you want the output features, which are buffer areas, to be symbolized as outlines with a hollow fill. You'll browse to a layer file included with this project.
Tip:
You can resize the Tool Properties dialog box by dragging its sides or edges.
- In the last row of the table, which now represents the Output Feature Class parameter, click in the table cell in the Symbology column and click the Browse button that appears.
- On the browse dialog box, under Project, click Folders.
- In the adjacent window, double-click Make_a_geoprocessing_model > commondata > userdata.
- Click BufferSymbol.lyrx to select it and click OK.
The path to the layer file appears in the Symbology column of the parameters table.
- Click OK on the Tool Properties dialog box.
Note:
In a project package, files that can't be stored in a geodatabase, such as shapefiles, CSV files, and text files, are included as attachments. Within the project package folder structure, attachments are stored in the commondata\userdata folder.
- On the ModelBuilder toolbar, click Save to save the model.
Earlier, you saw that your model output data was saved to the default geodatabase. This geodatabase also contains the model input data, such as feature classes of invasive grasses, campgrounds, roads, and trails. To keep your model output data separate from the input data, you'll create a geodatabase and make it the default geodatabase.
- In the Catalog pane, right-click the Databases container and click New File Geodatabase .
A browse dialog box appears and defaults to the location of the project's home folder. The name of the home folder, Make_a_geoprocessing_model, appears in the location bar at the top of the browse dialog box.
- In the Name box, type Model_output.
The new geodatabase will be stored in the home folder.
- Click Save.
- In the Catalog pane, expand the Databases container, if necessary, to see the new geodatabase.
Now you need to direct the output data from the model to this geodatabase.
- In the Catalog pane, right-click the Model_output geodatabase and click Make Default .
A home icon appears on the geodatabase to show that it is now the default geodatabase for the project. Geoprocessing outputs are saved to this geodatabase unless otherwise specified.
- In the Catalog pane, double-click the Summarize Invasive Species tool.
The Output Feature Class parameter appears at the bottom of the tool pane. The tool is ready to use.
- Close the model view. Confirm that the Marlborough map view is active.
Tip:
To reopen the model view, in the Catalog pane, right-click the model tool and click Edit.
Run the Summarize Invasive Species tool
You'll run the tool and inspect the output.
- In the Contents pane, turn off the Commercial Campgrounds and Nassella Tussock Range layers.
- Turn on the Campsites and White Edged Nightshade Range layers.
On the map, in the north of the region, it looks as if there are one or two campsites in proximity to White-edged nightshade.
- In the Geoprocessing pane, on the Summarize Invasive Species tool, set the Human Contact Locations parameter to Campsites.
- Set Buffer Distance to 1.5 Kilometers.
- Set Invasive Species to White Edged Nightshade Range.
- For the Output Feature Class file name, type Nightshade_Near_Campsites.
The Area Unit of Measure is set to Hectares by default.
- Click Run.
When the tool finishes, a completion message appears at the bottom of the Geoprocessing pane.
In the Contents pane, the Nightshade_Near_Campsites layer is symbolized with a black outline and hollow fill, as specified by the BufferSymbol layer file. At the present map scale, the buffer features may be obscured by the Campsites symbols.
- Zoom in on the map to see the buffers.
- In the Contents pane, right-click the Nightshade_Near_Campsites layer and click Attribute Table .
- If necessary, scroll across the table. Right-click the Summarized area in HECTARES field heading and click Sort Descending .
Only one campsite, Waimaru, has White-edged nightshade within 1.5 kilometers. The summarized area value is 7.35 hectares.
- Close the table.
- In the Catalog pane, expand the Model_output geodatabase to see the Nightshade_Near_Campsites feature class.
- On your own, use the Summarize Invasive Species tool to analyze other relationships between human contact locations and invasive species.
The tool works on selected input features for the Human Contact Locations layer. For example, you can analyze invasive species near principal highways in the Roads layer.
Document the Summarize Invasive Species tool
Your last task is to document the geoprocessing tool. The documentation will be similar to help for other geoprocessing tools: it will explain the tool's purpose and usage.
- In the Geoprocessing pane, on the Summarize Invasive Species tool, click Help to open the tool help.
The tool help opens in a browser tab or window. (The URL points to a local file on your computer.) The tool has a title but no other help. To document the tool, you edit its metadata.
- Close the browser tab or window showing the tool help.
- In the Catalog pane, right-click the Summarize Invasive Species tool and click Edit Metadata .
A metadata view opens. In the Contents pane, the elements of the metadata style are displayed.
Note:
If you're using the default Item Description metadata style, the only element listed in the Contents pane is Item Description. The metadata element is currently invalid because required information is missing. If you're using a different metadata style, you'll see other metadata elements as well. Item Description is the only element you need to edit in this tutorial.
- In the metadata view, in the Tags box, type or copy and paste the following tags: summarize, biosecurity, invasive species, New Zealand.
Ensure the tags are separated by commas. The tags are keywords that can help users find the tool if you share it as a geoprocessing package or as part of a project package.
- In the Summary (Abstract) box, add the following text: This tool is designed for analysis of plant biosecurity issues in New Zealand. It summarizes the range of invasive grass species near locations where people may come into contact with the grasses and facilitate their spread.
- In the Usage box, add the following text:
Human Contact Locations can be point, line, or polygon features. A selected subset of features may be used.
Invasive Species are normally polygon features, but the tool also accepts point and line features.
The Output Feature Class contains all the attributes of the Human Contact Locations layer. It also contains a buffer distance attribute and a summary attribute. The summary attribute totals the area of the invasive species range that lies within the specified buffer distance. If the Invasive Species features are points, the summary attribute counts the number of points. If the Invasive Species features are lines, the summary attribute totals the line length.
This geoprocessing model tool uses the Pairwise Buffer and Summarize Within tools. For more usage information, see the tool reference documentation for those tools.
Note:
If spell-checking is enabled on the settings page (as it is by default), some words may be marked as potential spelling errors. See Set proofing options for more information.
- Under Syntax, expand Human_Contact_Locations. In the Dialog Explanation box, add the following text: The features representing locations where people may encounter invasive grass species.
- Under Syntax, expand Buffer_Distance. In the Dialog Explanation box, add the following text: The distance zones around human contact locations that will be analyzed for the presence of invasive species.
- Under Syntax, expand Invasive_Species. In the Dialog Explanation box, add the following text: The invasive grass species to be analyzed for proximity to human contact locations.
- Under Syntax, expand Area_Unit_of_Measure. In the Dialog Explanation box, add the following text: The units in which the area range of invasive species within each buffer zone is expressed.
- Under Syntax, expand Output_Feature_Class. In the Dialog Explanation box, add the following text: The name of the output feature class.
- On the ribbon, on the Metadata tab, in the Manage Metadata group, click Save .
- In the Catalog pane, double-click the Summarize Invasive Species tool.
- In the Geoprocessing pane, hover over Help to see the tool summary.
- Hover over the information icon that appears next to tool parameters to see your explanations.
- Close the Summarize Invasive Species metadata view.
- Optionally, click Apply.
It isn't necessary to click Apply because every change you make in the Map Properties dialog box is saved when you click OK. However, clicking Apply allows you to see a change reflected immediately on the map. This is useful when you are making several changes and want to confirm the effect of a change before committing other changes.
This geoprocessing model automates an analysis workflow. It can be used to analyze any combination of human contact locations, invasive species, and distance relationships. If you share your model with other users, they can run the geoprocessing tool without opening the model view.
A model can be shared in various ways. If you share it as a project package (.ppkx file), the package will include the model, the map view, and all the project data. If you share it as a geoprocessing package (.gptx file), the package will include only the geoprocessing tool and sample input and output data layers. If you plan to share your model, you may want to substitute inline variables for hard-coded paths to input and output datasets.
More tutorials that use advanced ModelBuilder functionality are available in the help system. See, for example, Work with Iterate Feature Classes.