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 executes 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: 3:07.
- This video was created with ArcGIS Pro 2.3.
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: 60 minutes
- Software requirements: ArcGIS Pro
Note:
The tutorial steps in the online help reflect the look and capabilities of the current software release. If you have an earlier software version, use the offline help system to open the tutorial. To switch from the online to the offline help system, see Set the help source in the About ArcGIS Pro help topic. If you don't have ArcGIS Pro, you can sign up for an ArcGIS Pro free trial.
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, under your 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 menu items on the left, click Open. On the Open page, click Portal and click Open another project at the bottom of the page.
- On the Open Project dialog box, under Portal , click ArcGIS Online .
Note:
If you see ArcGIS Enterprise listed instead, you must add a portal connection or set your active portal to ArcGIS Online. Alternatively, you can download the tutorial data from a browser.
- At the top of the dialog box, in the Search box, type Make a geoprocessing model tutorial 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, look at the Owner column. Select the item with the owner name 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.
Note:
By default, project packages are unpacked to your <User Documents>\ArcGIS\Packages folder. You can change the default location in the Share and download options.
Explore the map
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.
- 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.
- In the Contents pane, turn the different invasive species layers on and off.
- On the Map tab, click Bookmarks . Use the bookmarks to get a closer look at the range of each invasive grass species.
- Turn the layers representing potential contact locations on and off in conjunction with the invasive species layers.
- When you finish exploring the map, on the Map tab, click Bookmarks and click Marlborough Region.
- In the Contents pane, turn on the following five map layers and turn off all others:
- Basemap Labels
- Commercial Campgrounds
- Nassella Tussock Range
- Region
- Basemap
Tip:
To turn all layers on or off at once, press and hold the Ctrl key and select or clear any layer's check box.
Create a model and add a process
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.
- From the Contents pane, drag and drop 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.
- Click OK on the Commercial Campgrounds dialog box.
- On the ribbon, on the ModelBuilder tab, in the Insert group, click Tools . (Click the icon, not the drop-down arrow.)
The Geoprocessing pane appears.
- In the Geoprocessing pane, on the Favorites tab, drag the Buffer tool into the model view next to Commercial Campgrounds.
Tip:
If you don't see the Buffer tool on the Favorites tab, type buffer in the search box at the top of the Geoprocessing pane.
A gray rectangle representing the Buffer 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 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 needs to be connected to input data and its tool parameters need to 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 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 Buffer tool. The process is not yet ready to run because a buffer distance needs to be set.
- Right-click the Buffer tool element and click Open.
- On the Buffer dialog box, for Distance [value or field], type 5. Change the units to Kilometers.
Note:
The Input Features layer is called Commercial Campgrounds:1 because names aren't duplicated in models. The input data variable itself already uses the name Commercial Campgrounds; therefore, a unique number is appended to the input layer name in the tool. The input layer is the same Commercial Campgrounds layer that is in the map.
- Click OK.
All the elements are colored, which means that the process is ready to run.
- Right-click the green output data variable, CommercialCampgrounds_Buffer, and click Add To Display.
This ensures that the output data will be added to the Contents pane as a map layer.
Note:
The Add To Display setting is honored when the model is run from the model view. When the model is run as a geoprocessing tool, output data is added to the map only if it is set as a model parameter. You'll run the model as a geoprocessing tool later in this tutorial.
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 Buffer tool element will turn red as it processes the input data.
- On the ribbon, on the ModelBuilder tab, in the Run group, 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 CommercialCampgrounds_Buffer layer and click Remove .
- In the Catalog pane, browse to Databases > Make_a_geoprocessing_model.gdb.
The output data, CommercialCampgrounds_Buffer, has been written to the project's default geodatabase. You may want to 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 Make_a_geoprocessing_model geodatabase, right-click CommercialCampgrounds_Buffer 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 tab, in the Run group, 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 tab, in the Model group, 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 tab, in the Model group, 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, browse to Toolboxes > Make_a_geoprocessing_model.tbx > Summarize Invasive Species.
When you saved the model, a model tool was created in your project 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.
- Make the model view active.
Notice that 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 tab, in the Model group, click Save .
- In the Catalog pane, right-click the Summarize Invasive Species model tool and click Open.
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 pick 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 and the corresponding parameter name in the geoprocessing tool. (You won't see the change until you reopen the tool.)
- Right-click the 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 Commercial_Campgrounds_Buffer output data variable and click Rename. Change the name to Contact Location Buffers and press the Enter key.
- On the ModelBuilder tab, in the Model group, click Save .
- In the Catalog pane, in the Make_a_geoprocessing_model toolbox, right-click the Summarize Invasive Species tool and click Open.
The tool parameter names match the model variable names.
Next, you'll clear the default values from the geoprocessing tool parameters. These values don't represent expected user settings, so there is no reason to have them appear by default.
- 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 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 tab, in the Model group, click Save .
- In the Catalog pane, right-click the Summarize Invasive Species tool and click Open.
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 ribbon.
- Make the model view active. On the ModelBuilder tab, in the Insert group, click Variable .
- On the Variable Data Type dialog box, click the drop-down arrow and click Feature Layer. (You may 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 tab, in the Insert group, click Tools .
- In the Geoprocessing pane, in the search box, type Summarize Within.
The tool opens 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 the Display tools with descriptions button and Display tools as a list button 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.
- 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 contextual Diagram 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.
- Click Save to save the model.
- In the Catalog pane, open 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 tab, in the Model group, click Properties .
- On the Tool Properties dialog box, click the Parameters tab.
The top-to-bottom order of parameters in 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 first column of the table (the numbered column), click the numeral 4 to select the last row, representing the Area Unit of Measure parameter.
- 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, representing the Output Feature Class parameter, click in the table cell in the Symbology column and click the Browse button that appears.
- In 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.
- 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 new geodatabase and make it the default geodatabase.
- In the Catalog pane, right-click Databases and click New File Geodatabase .
The browse dialog box appears and defaults to the location of the project's home folder. You should see two folders: commondata and p20.
Tip:
If necessary, browse to the home folder by clicking Folders in the directory and double-clicking Make_a_geoprocessing_model.
- In the Name box, type Model_output.
The new geodatabase will be stored in the home folder.
- Click Save.
- In the Catalog pane, expand Databases, 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, open 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.
- Set Area Unit of Measure to HECTARES.
- For the Output Feature Class file name, type Nightshade_Near_Campsites.
- Click Run.
When the tool finishes, a successful completion message appears at the bottom of the Geprocessing 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, browse to Databases > Model_output.gdb and confirm that Nightshade_Near_Campsites has been saved to this geodatabase.
- On your own, use the Summarize Invasive Species tool to analyze other relationships between human contact locations and invasive species.
Note:
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.
Make sure 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 Buffer tool and the Summarize Within tool. 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 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, right-click the Summarize Invasive Species tool and click Open.
- In the Geoprocessing pane, hover over the Help button 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.
- On the Quick Access Toolbar, click Save to save the project.
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 different 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 at Help > Analysis and geoprocessing > ModelBuilder > Tutorials.