Está en la página 1de 73

Getting to

Know
ModelBuilder

Offered by Shane Bradt through the UNH Cooperative


Extension Geospatial Technologies Training Center

Developed by Sandy Prisloe and Cary Chadwick at the


Geospatial Technology Program at the University of
Connecticut

January 2008

Getting to Know ModelBuilder


Exercise 1: Creating a Basic Model........................................................... 1
1. Opening ArcMap ..........................................................................................................................................1
2. The ArcMap Interface ..................................................................................................................................2
3. Customize Your Geoprocessing Options ....................................................................................................3
4. Create a New Toolbox in ArcToolbox ........................................................................................................4
5. Add a New Model to Your Toolbox............................................................................................................5
6. Exploring the ModelBuilder Interface ........................................................................................................6
7. Create a Basic Model ...................................................................................................................................8
8. Update Model Properties............................................................................................................................12
9. Run Your Model .........................................................................................................................................13
10. Save Your Work .......................................................................................................................................14
11. Finding Help .............................................................................................................................................14
LET’S REVIEW!.............................................................................................................................................16

Exercise 2: Advancing Your ModelBuilder Skills ................................... 17


1. Opening ArcMap ........................................................................................................................................17
2. Locating Tools in ArcToolbox ..................................................................................................................17
3. Viewing Tool Documentation in ArcToolbox..........................................................................................18
4. Add a Toolbox to ArcToolbox...................................................................................................................19
5. Create a New Model...................................................................................................................................19
6. Update Model Properties............................................................................................................................28
LET’S REVIEW!.............................................................................................................................................29

Exercise 2: Extra Credit............................................................................ 31


1. Create a New Model and Copy Elements from another Model to It.......................................................31
2. Add the Frequency Tool to the Model (only available with the ArcInfo license) ........................................31
3. Add the Buffer Tool to the Model .............................................................................................................32
4. Set the Model Properties ............................................................................................................................33
5. Run the Model ............................................................................................................................................33
6. Other Processes to Add to the Model .........................................................................................................34

Exercise 3: Building an Iterative Model ................................................... 35


1. Create a New Model...................................................................................................................................36
2. Create a Series Variable .............................................................................................................................36
3. Create a List Variable.................................................................................................................................39
4. Setting Iteration Variables .........................................................................................................................42
5. Set the Iteration Count................................................................................................................................43
6. Run Your Model .........................................................................................................................................44
LET’S REVIEW!.............................................................................................................................................45

Exercise 4A: Creating a Generic Model ................................................... 47


1. Opening ArcMap ........................................................................................................................................47
2. Create a New Model...................................................................................................................................48
3. Create Parameters from Model Variables .................................................................................................49

Exercise 4B: Adding Documentation to a Model...................................... 55


1. Exploring the ArcToolbox Documentation Editor ...................................................................................55
2. Adding Metadata Documentation to Your Model....................................................................................57
3. Adding Documentation to the Tool’s Dialog Window ............................................................................58
4. Adding Documentation to the Tool’s Reference Page.............................................................................60
5. Test out Your Generic Model ....................................................................................................................66
LET’S REVIEW!.............................................................................................................................................69

Getting to Know ModelBuilder


Getting to Know ModelBuilder
Exercise 1: Creating a Basic Model
The first exercise is designed to introduce you to the basic components of the ModelBuilder
application. You will add a new toolbox to your ArcToolbox window, create and add a new model
to the toolbox, and build a simple model within the ModelBuilder interface. In the process you will
explore the ModelBuilder interface and learn some of the basic operations necessary for
constructing a model. You also will learn about some important ArcMap settings that make using
and managing your models easier.

1. Opening ArcMap
To start the ArcMap application, double click with the left mouse button on the ArcMap shortcut

on the desktop. If there is no shortcut, then start the program by clicking on


Start>Programs>ArcGIS>ArcMap. It may take awhile for ArcMap initially to open so be patient.

When ArcMap first opens, you will see a window that asks if you want to open A new empty
map, A template or An existing map.

Make sure that “A new empty map” is


selected and then click the OK button.

Introduction to ModelBuilder Exercise 1 page 1


2. The ArcMap Interface
The ArcMap GUI will look something like what you see below. (Note: It may look different
depending on whether additional functionality has been enabled by a previous user.) You should
be familiar with the basic ArcGIS functions. Some of the major components of the ArcMap
interface are labeled below.

Title bar
Menu bar Toggles on/off ArcToolbox

Standard
toolbar Map Display Scale

Tools toolbar

Table of Display Area


Contents

X – Y coordinates of
cursor position

Status bar

Refresh
Layout View
Tabs to change among the Data View
Table of Contents formats

Introduction to ModelBuilder Exercise 1 page 2


3. Customize Your Geoprocessing Options
ModelBuilder models are stored within toolboxes in the ArcToolbox application. Toolboxes exist
as a file stored on disk (as a .tbx file) or as an object in a geodatabase. You can create a new
toolbox in the ArcToolbox window by right-clicking the ArcToolbox entry and selecting the New
Toolbox command in the context menu. A new toolbox is created with the default name “Toolbox”
and is written to a folder called My Toolboxes. The system default location for the My Toolboxes
folder is C:\Documents and Settings\<login>\Application Data\ESRI\ArcToolbox\My Toolboxes. It
is often useful to change the default location where your toolbox files (.tbx) are stored. In this step
you will change the ArcMap geoprocessing options to specify another location for your new
toolbox files.

- Click the Tools drop-down menu and select Options from the list of choices. This
will open a window which will allow you to specify various options for working with
ArcMap. Any change made to the Options settings will apply to all of your ArcMap
projects thereafter.

- Click on the Geoprocessing tab.

- Under General, make sure the option for “Overwrite the outputs of geoprocessing
operations” is checked.

- Under My Toolboxes, click the yellow folder icon and browse to your
C:\ModelBuilder\Toolboxes folder.

- Under ModelBuilder, be sure that “When connecting elements, display valid


parameters when more than one is available” is checked. Under
Display/Temporary Data, check the box next to “Add results of geoprocessing
operations to the display”. Your Options window should look similar to the graphic
below. Click OK to close the Options dialog window.

Introduction to ModelBuilder Exercise 1 page 3


4. Create a New Toolbox in ArcToolbox
Toolboxes within ArcToolbox can be either system toolboxes (those installed with ArcGIS) or
custom toolboxes (those that you create yourself). You can create new toolboxes in either
ArcMap or ArcCatalog. After creating a toolbox, you can then add tools from system toolboxes or
create custom tools and models. When you save a project in ArcMap, any custom toolboxes you
have added to ArcToolbox will be saved to the document and will be available the next time you
open the project. When you open a blank map project in ArcMap however, default geoprocessing
tools are loaded into ArcToolbox, which may or may not include your custom settings. See the
note below to learn how to change the default ArcToolbox settings.

NOTE: Changing Default ArcToolbox Settings: There are two methods to


include custom toolboxes in the default ArcToolbox settings. One is to arrange
toolboxes in ArcCatalog. When you exit ArcCatalog, the current geoprocessing
tools, including all custom tools and toolboxes, are saved on your computer as
default settings. Another option is to right-click on the ArcToolbox heading and
select Save Settings>To Default. This method will work in both ArcCatalog and
ArcMap.

- If ArcToolbox is not visible in your ArcMap application, click on the ArcToolbox icon
on the Standard Toolbar.

- Right-click on the ArcToolbox entry and select New Toolbox in the menu that
appears.

- A toolbox named “toolbox” will be added to your ArcToolbox window. Right-click on it


and select Rename from the window that appears. Rename your toolbox
ModelBuilder Tools. You are now ready to start adding models to your new toolbox!

Introduction to ModelBuilder Exercise 1 page 4


Note: In Step 3, we updated the ArcGIS geoprocessing options
and changed the default location where custom toolbox (.tbx)
files are stored. The ModelBuilder Tools toolbox that you just
created is saved in the new default location:
C:\ModelBuilder\Toolboxes. Any additional toolboxes you
create will also be saved in this file location.

5. Add a New Model to Your Toolbox


- Right-click on your new ModelBuilder Tools toolbox and hover over New and select
Model from the window that appears. This will add a new model to your toolbox and
automatically open the ModelBuilder application.

Introduction to ModelBuilder Exercise 1 page 5


6. Exploring the ModelBuilder Interface
You should now be looking at a blank ModelBuilder window. We will start to add elements to your
model in just a minute, but first, let’s take a moment to explore some of the components of the
ModelBuilder application.

Main Menu

Toolbar

Model
diagram
area

Model Elements (added by the user)

There are five pull-down menus on the Main menu. Below is a description of each menu item and
its function.

MENU FUNCTION
Provides options for running, validating, viewing messages, saving, printing,
Model importing, exporting, and closing the model. Model properties can also be accessed
through this menu option.
Edit Cut, copy, paste, delete, and select model elements.
Contains an Auto Layout option that applies the settings specified in the Diagram
View
Properties dialog box to your model. It also contains options for zooming in or out.
Contains an overview window that you can use to display the entire model while
Window
zoomed into a certain part of a model in the display area.
Provides access to the ArcGIS Desktop help system and the About ModelBuilder
Help
window.

Introduction to ModelBuilder Exercise 1 page 6


The ModelBuilder toolbar allows a user to add data to a model, navigate around the diagram
area, select and connect elements, and save, print, and run a model.

Print Add Data Select Run


Model or Tool Elements Model

Save Cut/Copy/Paste Navigation Tools Connect


Model Elements

In order to use most of these tools, you will need to add elements to your model. The next step
will take you through creating a basic model in ModelBuilder.

Introduction to ModelBuilder Exercise 1 page 7


7. Create a Basic Model
In this step, you will create a basic model that uses the dissolve tool to aggregate soil polygons
based on specific attributes, in this case, those which describe wetland soils. The result will be a
new dataset that defines the wetland soils. You will also use the Calculate Areas tool to
recalculate the area of the resulting wetland polygons. The last step will be to add layer
symbology to your wetland soils output.

Haddam Soils Dissolved Soils

New Area Field

Layer symbology applied to output

Introduction to ModelBuilder Exercise 1 page 8


- Click on the Add Data button on your ModelBuilder Toolbar.

- Navigate to your C:\ModelBuilder\Data\Shapes folder and add Haddam_Soils.shp


to the ModelBuilder display window.

- In ArcToolbox, expand the Data Management Tools toolbox and the Generalization
toolset. In the Generalization toolset, you should see the Dissolve tool.

- Click on the Dissolve tool and drag and drop it into the ModelBuilder display window.

Note: Below are the default shapes and colors for each of the five ModelBuilder
elements: tools, value variables, project data, derived data, and derived values. You
can right-click on an element to change its default color and font. Tools are generally
represented in models as rectangles and data and parameter values are represented
as ovals.

- Click on the Connect Elements tool on the ModelBuilder toolbar. You will notice
that the cursor turns into a wand as you mouse over the model diagram window.

- Click on the Haddam_Soils.shp element in the ModelBuilder dialog window and


drag the connector to the Dissolve tool and release the mouse button.

Introduction to ModelBuilder Exercise 1 page 9


- A Select Parameter window will open. Select Input Features (Parameter) and click
OK. Your Haddam_Soils.shp element should now be connected to the Dissolve
tool in your ModelBuilder dialog window. All elements in the window should be
shaded, indicating that to tool is ready to be run.

- You can open a tool’s dialog window by double-clicking on it in the ModelBuilder


diagram window. Double-click on the Dissolve tool element in the model diagram to
open its dialog window and to view the tool’s parameters.

- Click the yellow folder icon to the right of Output Feature Class.

- Navigate to your C:\ModelBuilder\Data\ModelResults folder and save the output as


Haddam_Soils_Dissolve.shp Shane Bradt 4/21/08 10:08 PM
Deleted: Data\
- Under Dissolve Fields, check the box next to CTWET. This field contains attributes
which define wetland soils.

- Scroll down to the bottom of the Dissolve window and make sure Create multipart
features is checked.

- Click OK to close the Dissolve window.

- In ArcToolbox, expand the Spatial Statistics Tools toolbox and the Utilities toolset.
Click on the Calculate Areas script and drag and drop it into the ModelBuilder dialog
window.

- Select the Connect Elements tool on the ModelBuilder toolbar and click on the
Haddam_Soils_Dissolve.shp element in the ModelBuilder dialog window. Drag the

Introduction to ModelBuilder Exercise 1 page 10


cursor to the Calculate Areas element and release the mouse button. Select Input
Feature Class (Parameter) in the window that appears. Click OK.

- Double-click on the Calculate Areas element in the ModelBuilder dialog window to


open its parameters.

- Click the yellow folder icon to the right of Output Feature Class and navigate to
your C:\ModelBuilder\Data\ModelResults folder and name your output
Wetland_Soils_Area.shp. Click OK. Shane Bradt 4/21/08 10:09 PM
Deleted: Data\
- Click OK to close the Calculate Areas window.

- Right-click on Wetland_Soils_Area.shp and uncheck Intermediate. This will ensure


that your output data is made permanent.

- Right-click on Wetland_Soils_Area.shp again and check Add to Display. This will


automatically add your output dataset to the ArcMap Table of Contents after the
model is run.

At this point, your model elements should all be shaded, indicating that your model is ready to
run. The last step is to reference a layer file to symbolize the features in our
Wetland_Soils_Area.shp. The layer file will define how the features are drawn in the ArcMap
display window.

Model elements
are “empty”
indicating
process is not
ready to be run

Model elements
are “shaded”
indicating process
is ready to run.

- Right-click on Wetland_Soils_Area.shp and open the Properties window for the


element. Click on the Layer Symbology tab.

- Click on the yellow folder to the right of Import the symbology from: box and
navigate to your C:\ModelBuilder\Data\Layers folder and select Wetland_Soils.lyr.
Click Add. Click OK in the Wetland_Soils_Area.shp Properties window.

Note: Layer files contain information about geospatial datasets such as where they
reside on the disk or network, how they are defined, symbols that are used to
render the layer, labels, etc. Layer files do NOT include the actual geographic data
and their attributes.

Introduction to ModelBuilder Exercise 1 page 11


8. Update Model Properties
Before we run the model, let’s update the model properties and save our model.

- Click on Model on the ModelBuilder main menu and select Model Properties from
the dropdown menu that appears.

- On the General tab of the Model Properties window, change the model name to
“Exercise1”. Do not include spaces in the name.

- Change the model Label to “Exercise 1: Building a simple model”.

- Under description, type a short paragraph about the purpose of this model. Try
something like: “This model is designed to create a wetland soils map for the town of
Haddam, CT. Soil polygons are dissolved based on a field containing attributes
defining wetland soils. The area of the resulting wetland soil polygons is recalculated
and symbology is applied to the dataset by referencing a wetland soils layer file”.

- Check “Store relative path names (instead of absolute paths)” at the bottom of
the window.

- Click OK to close the Model Properties window.

Name: This is the actual name of the


model as it is referred to in scripting
or command line. It should be
concise and have NO SPACES!

Label: This is the “user-friendly”


name for the model. It will appear
next to its icon in ArcToolbox and
ArcCatalog. It can contain spaces.

Description: An overview of the


model. Briefly describe purpose and
derived results.

Relative Pathnames: When


checked, the model will reference
relative pathnames rather than
absolute pathnames.

Introduction to ModelBuilder Exercise 1 page 12


- It’s always a good idea to save your model before you run it. Click Model on the
ModelBuilder main menu and select Save (alternatively, you could click the save icon
on the ModelBuilder toolbar). Notice that your model name has been updated in
ArcToolbox.

9. Run Your Model


Congratulations! You have completed your first model. Now let’s test it out.

- Click the Run button on the ModelBuilder toolbar. Notice that a dialog window
opens describing the geoprocessing tasks that are being completed as the model
runs. Also notice how each model element is highlighted in red as the process is run.
Once a process is successfully completed, the model element becomes shadowed. If
an error occurs, a message will appear in the dialog box. Any processes that were
not successfully completed will not appear shadowed in the ModelBuilder window.

Shadowing indicates model


process has been
successfully executed

Process highlighted in
red indicates it is
currently being executed

Processes not shadowed


indicate that they have not
been successfully executed
Dialog window provides details
about model processes, errors,
and run time.

- Click Close to close the geoprocessing message window.

- Minimize the ModelBuilder interface.

- In the ArcMap Table of Contents, right-click on your Wetland_Soils_Area data layer


and select Open Attribute Table from the menu that appears.

Introduction to ModelBuilder Exercise 1 page 13


- You should see that a new field called F_AREA (feature area) has been added to the
table and the area in map units (in this case square feet) has been calculated for
each wetland soil type.

If your model ran successfully, you should have a wetland soils layer for the town of Haddam in
your ArcMap Table of Contents that looks like the image below.

10. Save Your Work


- Click on the File drop-down menu in ArcMap.
- Select Save As…
- Navigate to the folder named C:\ModelBuilder\Projects and save your work as
MyEx1.mxd

11. Finding Help


ArcMap includes an extensive online help system – and it really pays to get comfortable using it.
Spend a few minutes exploring some of the help options associated with ModelBuilder.

To access or search for help with specific questions, either click the Help menu and then select
ArcGIS Desktop Help or just press the F1 key. A typical Windows-type help system will open
where you can search, enter key words into an Index, or read documentation organized by
content. There is also a Favorites tab which is similar to a bookmark. It allows you to remember
help pages you want to revisit and it gives you quick access to pages you visit regularly.

Introduction to ModelBuilder Exercise 1 page 14


ArcGIS Desktop and Online Help contain a lot of detailed information about ModelBuilder that can
help solve many of your geoprocessing headaches. Click on the Search Tab in the ArcGIS
Desktop Help window and type in ModelBuilder as your search criteria. Click the Ask button to
execute the search function. A number of topics related to ModelBuilder will appear. Click on one
to view the help document associated with the topic. Also try using the Index tab and search the
keyword ModelBuilder. Spend a few minutes browsing the help categories associated with the
ModelBuilder application.

Introduction to ModelBuilder Exercise 1 page 15


LET’S REVIEW!
This exercise was designed to introduce you to ModelBuilder by having you create a very basic
model. Some of the important topics covered in the exercise include the following:

 Setting your ArcGIS geoprocessing options: There are a number of


geoprocessing options that you should set before you begin building models.
These include the pathname to a folder where models will be stored; whether
model outputs will be overwritten; whether a list of parameter options will pop-up
when connecting elements in the ModelBuilder editor; etc.
 Creating new toolboxes in ArcToolbox: How to create a new Toolbox that is
added to ArcToolbox.
 Creating a new model within a toolbox: How to create a new “empty” model in
a new or existing toolbox.
 Exploring the ModelBuilder interface: You used the ModelBuilder interface
and learned about the menu and toolbars and experimented with some of the
navigation tools that control the model display.
 Creating a basic model: You created a very simple model and in the process
learned about adding and connecting model elements.
 Dissolve tool and Calculate Areas tool: You added two system geoprocessing
tools to a model and connected them to input and output datasets.
 Updating model properties: You updated model properties and changed the
model’s name and label; added a short description of what the model is designed
to do and specified that the model can use relative pathnames.
 Saving your model: You saved the model - like everything in ArcMap, if you
don’t save it you lose it. Saving the model also updates the model’s label in
ArcToolbox.
 Running a model from the ModelBuilder editor: After building the model, you
learned how to run it from within the ModelBuilder editor. You can run the entire
model from start to finish or you can run it one tool at a time.
 Accessing ModelBuilder help topics: There is extensive online help that is
invaluable as you get started working with ModelBuilder. Remember to use it as
you learn this application!

This concludes Exercise 1.


Save your ArcMap project in your
C:\ModelBuilder\Projects folder as MyEx1.mxd

If you have finished and the class is still working on the exercise, go back and try some of the
tasks you just completed. Explore – experiment – read some more Help.

Introduction to ModelBuilder Exercise 1 page 16


Exercise 2: Advancing Your ModelBuilder Skills
The first exercise was designed to introduce you to the basic components of the ModelBuilder
application. In this exercise, you will build a more complex model that will introduce you to
several new tools. The purpose of the model will be to create a wetland soils layer for a single
town. The wetlands will be derived from a county soils map and then clipped to a user selected
town boundary. The area of the derived wetland soils will be recalculated in square feet and then
again in acres and summed to determine the total area of wetland soils for the selected town. It is
a useful model that can easily be rerun for another soil type or town.

1. Opening ArcMap
To start the ArcMap application, double click with the left mouse button on the ArcMap shortcut

on the desktop. If there is no shortcut, then start the program by clicking on


Start>Programs>ArcGIS>ArcMap. It may take awhile for ArcMap initially to open so be patient.

When ArcMap first opens, you will see a window that asks if you want to open A new empty
map, A template or An existing map.

Make sure that “A new empty map” is selected and then click the OK button.

2. Locating Tools in ArcToolbox


Depending on what ArcGIS license you are using, you have access to up to 400 geoprocessing
tools in ArcToolbox. So how do you find the one you need? Until you are familiar with the
toolsets, it can be pretty overwhelming. Luckily, there are some options in ArcToolbox which allow
you to find what you’re looking for or discover tools you didn’t even know exist! Let’s take a
minute to explore the ArcToolbox search options.

- If ArcToolbox isn’t visible in your ArcMap application, click on the toolbox icon on
the Standard Toolbar to turn in on.
- At the bottom of the ArcToolbox window you will see four
tabs: Favorites, Index, Search, and Results. Click on
each to view the interface associated with each tab. You
are probably most familiar with the Favorites tab which
shows all toolboxes saved to the default settings.
- Click on the Index tab. This interface is useful if you
know the name of the tool you want, but just can’t
remember what toolbox or toolset it is in. Type in the
keyword “clip”. You will see all tools that pertain to
clipping features listed in the window below. Choose the
Clip (analysis) tool. You can double-click to open its
dialog or click the Locate button which will switch back
to the Favorites tab and open the toolbox and toolset
where the Clip tool is located. Try both techniques.

Introduction to ModelBuilder Exercise 2 page 17


- Next click on the Search tab. The Search tab works a lot like the Index tab except
that it searches ArcToolbox not only by tool name, but also by descriptions and
keywords. This is useful if you know the function you want to use, but do not
necessarily know what the tool is called. Take a minute to familiarize yourself with the
Search tab.
- Finally, click on the Results tab. Whenever a tool is executed using its dialog or as a
command in the Command Line window, useful information about tool processes are
written to the Results tab of the ArcToolbox window. Each result contains input and
output datasets and values and any messages that are created as the tool is
executed. Most likely you will not see any geoprocessing results here because we
have not run any tools from dialog windows or command line.

3. Viewing Tool Documentation in ArcToolbox


It is often helpful to examine the documentation associated with geoprocessing tools before using
them for a task or in a model. In this step, you will learn how to open tool documentation from
ArcToolbox.

- Locate a tool in ArcToolbox using one of the search techniques you just learned.
- Right-click on the tool in ArcToolbox and click Help in the menu that appears. This
will open the tool’s reference page, which gives an overview of how the tool works
and provides links to further documentation.
- Once you have finished exploring the help documentation, close the window.

Introduction to ModelBuilder Exercise 2 page 18


4. Add a Toolbox to ArcToolbox
Now that you have learned how to locate tools in ArcToolbox, let’s begin building another model.
Several new tools will be introduced and many of the techniques you learned up to this point will
be used to complete your second model. Refer back to previous steps or ask an instructor for
assistance if you need help.

- Right-click on the ArcToolbox entry and


select Add Toolbox from the window that
appears.
- In the Add Toolbox window, navigate to
your C:\ModelBuilder\Toolboxes folder
and add your ModelBuilder Tools toolbox
that you created in Exercise 1 to the ArcToolbox application.

5. Create a New Model


- Right-click on your ModelBuilder Tools toolbox in ArcToolbox and hover your
mouse over the word New and select Model in the window that appears. This will
create a new model in the toolbox and open the ModelBuilder interface.

- In ModelBuilder, click on the Add Data button on the ModelBuilder toolbar.


- Navigate to your C:\ModelBuilder\Data\Shapes folder and add
TownsMiddlesexCounty.shp to the ModelBuilder window.
- In ArcToolbox, click on the Index tab. Type in the keyword “Select”. In the list of tools
that results from your keyword search, locate Select (analysis). Click once on it and
then click on the Locate button at the bottom of the ArcToolbox window. This should
locate the Select tool in the Extract toolset in the Analysis Tools toolbox. Right-click
on the Select tool in ArcToolbox and select Help from the menu that appears.
Review the tool documentation from the Help menu. It’s a good idea to familiarize
yourself with new tools before you use them for a geoprocessing task.
- After you have reviewed the tool’s documentation, close the Help window. Click on
the Select tool from ArcToolbox and drag and drop it into the ModelBuilder window.

- Click on the Connect Elements tool on the ModelBuilder toolbar and connect the
TownsMiddlesexCounty.shp to the Select tool. Choose Input Features
(Parameter) from the Select Parameter window that appears. Click OK.
- Double-click on the Select tool to open the dialog window.
- Input Features should already be set
to TownsMiddlesexCounty.

- Click on the yellow folder icon


under Output Feature Class and
navigate to your
C:\ModelBuilder\Data\ModelResults
folder. Name the output
town_select.shp
- Click the Save button.
- Under Expression (Optional), click on
the SQL icon to open the Query
Builder window.

Introduction to ModelBuilder Exercise 2 page 19


- In the Query Builder window, double-click on “TOWN”, single-click on “=”, single-
click on “Get Unique Values”, and double-click on any of the town names. For
example, a valid query would be: “TOWN” = ‘Chester’

1. Double-click “TOWN”

4. Double-click to
2. Single-click = select a town

3. Single-click
Get Unique Values

- Click OK to close the Query Builder window.


- Click OK to close the Select tool dialog window.

- Click the Save icon on the ModelBuilder toolbar to save all changes to the model.

Introduction to ModelBuilder Exercise 2 page 20


You have just completed the first step of this model. Next, you are going to select the wetland
soils from a county soils data layer and then clip them to the extent of your selected town’s
boundary. To do this, you will use the Make Feature Layer tool to create a selection layer. A
layer is different from a data set. It is stored in-memory and references data stored on a hard
drive or network. The Make Feature Layer tool often is used in models because many join and
selection tools require layer files as their input data.

- Click the Add Data button from the ModelBuilder toolbar and navigate to your
C:\ModelBuilder\Data\Shapes folder and add middlesexsoils.shp. Click Add.

- Use your Select Elements tool to drag middlesexsoils.shp below the other
elements in your ModelBuilder display area.
- In ArcToolbox, find the Make Feature Layer tool and add it to your ModelBuilder
display area. If you don’t remember how to locate this tool, refer to Step 2 of this
exercise.

- Click on the Connect Elements tool on the ModelBuilder toolbar. Connect


middlesexsoils.shp to the Make Feature Layer tool you just added. In the window
that appears, select Input Features (Parameter). Click OK.
- Double-click on the new Make Feature Layer element to open the tool’s dialog
window.
- Input Features should already be set
to middlesexsoils.shp.
- Change the Output Layer to
Wetland_Soils_Layer.
- Under Expression (Optional), click on
the SQL icon to open the Query
Builder window.

- Construct the following query using the Query Builder tools: “CTWET” <> ‘Non-
wetland soils’ (be sure to use the <> button, not the < and > separately). This is an
expression that will select all features in the CTWET field that are not non-wetland
soils. In other words, all the features that are wetland soil polygons or water.
- Click OK to close the Query Builder window. Click OK again to close the Make
Feature Layer window.

- Click the Save button on the


ModelBuilder toolbar to save all
changes to your model.

Introduction to ModelBuilder Exercise 2 page 21


So far, you have set up a model to select a specific town and save the selection to a new data set
called town_select.shp. You have also set up a process to select only wetland soils from a county
soils shapefile and save the result to a new layer called Wetland_Soils_Layer. Now we will use
the Clip tool to clip the wetland soils layer to your selected town boundary.
- In ArcToolbox, locate the Clip (analysis) tool. Click and drag it into the ModelBuilder
window.

- Click on the Connect Elements tool on the ModelBuilder toolbar.


- Click on the Wetland_Soils_Layer element and drag the connection to the Clip tool
element in the ModelBuilder window.
- In the window that appears, select Input Features (Parameter) and click OK.
- Use the Connect Elements tool again to click on town_select and drag the
connection to the Clip tool element in the ModelBuilder window.
- In the window that appears, select Clip Features (Parameter) and click OK. The Clip
tool element should now be shaded, indicating that it is ready to run.
- ModelBuilder provides a default name to the Output Feature data layers. Let’s
change the name and path to make it more meaningful. Double-click on the Output
Feature element in the ModelBuilder window.

- In the Output Feature Class window that opens, click on the yellow folder
under Output Feature Class and navigate to your
C:\ModelBuilder\Data\ModelResults folder. Name the output
Wetland_Soils_Clip.shp. Click Save to close the window and click OK to close the
Output Feature Class window.
- Let’s test our model. Before we run it however, we need to specify which output to
add to the ArcMap Table of Contents after our model has been run.
- Right-click on Wetland_Soils_Clip.shp element in the ModelBuilder window and
select Add to Display. This will ensure that Wetland_Soils_Clip.shp is added to the
Table of Contents after the Clip tool has been executed.

Introduction to ModelBuilder Exercise 2 page 22


- Click the Save button on the ModelBuilder toolbar to save all changes to your
model.
- Now we should be ready to test out the first part of our model. Click the Run
button on the ModelBuilder toolbar. If your model ran successfully, you should see a
layer in your Table of Contents called Wetland_Soils_Clip which contains wetland
features for the town you chose to evaluate.
- Close the geoprocessing message window and minimize ModelBuilder.

- In ArcMap, try using the Identify tool to view the different soil attributes. They
should all be wetland soils or water features.

Let’s continue building onto our model. The next step will be to add a field to the
Wetland_Soils_Clip shapefile and calculate the area of each feature using the Calculate Areas
script. This will calculate the area in map units, which in this case is square feet.
- Restore your ModelBuilder window.
- From ArcToolbox, expand the Spatial Statistics Tools toolbox and the Utilities
toolset. Click on the Calculate Areas script and drag and drop it into the
ModelBuilder window.
- Use the Connect Elements tool to connect Wetland_Soils_Clip.shp to the
Calculate Areas element. In the window that appears, select Input Feature Class
(Parameter) and click OK.
- Double-click on the Output Feature element to open its dialog box.

- Click on the yellow folder under Output Feature Class and navigate to your
C:\ModelBuilder\Data\ModelResults folder. Name the output
Town_Wetland_Area.shp and click Save to return to the dialog box. Click OK to
close the window.
- Since this layer is going to be one of our output layers, let’s apply layer symbology to
the dataset. Right-click on the Town_Wetland_Area.shp element in the
ModelBuilder window and select Properties from the menu that appears.

Introduction to ModelBuilder Exercise 2 page 23


- Click on the Layer Symbology tab in the Town_Wetland_Area.shp Properties
window.

- Click on the yellow folder under Import the symbology from: and navigate to
your C:\ModelBuilder\Data\Layers folder and select Wetland_Soils.lyr. This is the
layer file that contains symbology definitions for wetland soils. Click Add.
- Click OK to close the Town_Wetland_Area.shp Properties window.
- Right-click on the Town_Wetland_Area.shp element and select Add to Display in
the menu that appears. This will ensure that the layer is added to the ArcMap Table
of Contents after the model is run in the ModelBuilder window.

- Click the Save button on the ModelBuilder toolbar to save all changes to your
model. Next, we’ll add the Add Field element to the model.
- From ArcToolbox, expand the Data Management Tools toolbox and the Fields
toolset. Click on the Add Field tool and drag and drop it into the ModelBuilder
window. This tool will allow you to add a new field to a layer’s attribute table.

- Use the Connect Elements tool to connect the Town_Wetland_Area.shp


element to the Add Field tool in the ModelBuilder window. In the window that
appears, select Input Table (Parameter) and click OK.
- Double-click on the Add Field element in the display window.
- Under Field Name in the Add Field window, type Acres.
- Under Field Type, click the down arrow and change it to FLOAT. Set the Precision
to 8 and the Scale to 1. Click OK to close the Add Field window. You should now
see that the Add Field element is shaded indicating that the tool is ready to be run.

- Right-click on Town_Wetland_Area.shp (2) and check Add to Display.

- Click the Save button on the ModelBuilder toolbar to save all changes to your
model.

The geoprocessing tools you will add in the following steps depend on the values derived from
the Calculate Areas and Add Field elements you just added to your model. Let’s run the model
again from the Calculate Areas element before going on.

Introduction to ModelBuilder Exercise 2 page 24


- Click the Run icon on the ModelBuilder toolbar. This will run the model from the
Calculate Areas element through to the end. Any model elements that have already
been executed will not be run. Remember, elements that have a grey shadow behind
them indicate that they have already been run.
- Close the geoprocessing message window and minimize the ModelBuilder window.
- Let’s view some of the results of your model processes. Right-click on the
Town_Wetland_Area layer in the ArcMap Table of Contents and select Open
Attribute Table.
- Scroll to the end of the Town_Wetland_Area attribute table. Notice that the last two
fields (F_AREA (feature area) and Acres) in the table were added by the model
processes you just completed. The next step will be to calculate the area in acres of
each of the wetland features using the F_AREA field. Click the red in the upper
right-hand corner of the attribute table to close it.
- Restore your ModelBuilder window.
- In ArcToolbox, locate the Calculate Field tool and drag and drop it into the
ModelBuilder window. This tool will allow you to calculate values for the Acres field of
the Town_Wetland_Area shapefile.

- Use the Connect Elements tool to connect the Town_Wetland_Area.shp (2)


element to the Calculate Field tool in the ModelBuilder window. In the window that
appears, select Input Table (Parameter) and click OK.
- Double-click on the Calculate Field element in the display window.
- Input Table should already be set to Town_Wetland_Area.shp(2).
- Under Field Name, click the dropdown arrow and select Acres.

- Under Expression, click the Calculator icon to open the Field Calculator.
Under Fields: double-click on F_AREA. Single-click on the division symbol on
the right side of the Field Calculator window. Type in 43560 to complete the equation.
Note: F_AREA contains the feature area in square feet. Dividing that number by 43,560
(the number of ft2 per acre) converts the feature area to acres.
Your calculation should look like the graphic below:

Double-click
Single-click

Type number with keyboard

Introduction to ModelBuilder Exercise 2 page 25


- Click OK to close the Field Calculator.
- Click OK to close the Calculate Field tool.

The final step in this model is to use the Summary Statistics tool to summarize the Acres field.
Before we can do this however, we must run the model again in order to derive data from the
Calculate Field tool which will then be used as input data for the last step in the model.
- Right-click on the Calculate Field element in your model and select Run from the
menu that appears. This option will allow you to run a single process at a time.
- After the process has been successfully executed, click Close in the model dialog
window.
- Locate the Summary Statistics tool in ArcToolbox and drag and drop it into the
ModelBuilder window. This tool will allow you to calculate summary statistics for the
acres field in your wetland soils layer.

- Use the Connect Elements tool to connect the Town_Wetland_Area.shp (3)


element to the Summary Statistics tool in the ModelBuilder window. In the window
that appears, select Input Table (Parameter) and click OK.
- Double-click on the Summary Statistics element in the display window.

- The Input Table should be


Town_Wetland_Area.shp (3).

- Click the yellow folder icon under Output


Table and navigate to your
C:\ModelBuilder\Data\ModelResults folder.
Name the output Town_Wetland
_Statistics.dbf. Click Save.
- From the Statistics Field (s) dropdown select
the Acres field. Ignore the that appears
next to the field.
- Click in the white space in the first cell under
Statistic Type (to the right of Acres). You will
see a dropdown list appear. Select SUM. Your
Summary Statistics window should look like
the graphic to the left. Click OK to close the
window.

- Run your model one last time to execute the Summary Statistics element.
- After the process has been successfully completed, click Close in the geoprocessing
message window.
- Right-click on the Town_Wetland_Statistics.dbf element in your ModelBuilder
window and select Add to Display.
***Note: because Town_Wetland_Statistics is a table, it will be added to the Source
tab in the Table of Contents. If you are on the Display tab, you will not see it!

Introduction to ModelBuilder Exercise 2 page 26


- Click the Save button on the ModelBuilder toolbar to save all changes to your
model. Close the ModelBuilder window by clicking on the red in the upper right-
hand corner of the window.
- In ArcMap, right-click on the Town_Wetland_Area layer in the Table of Contents and
select Open Attribute Table.
- Scroll to the end of the table. Notice that the Acres for each wetland soil type has
been calculated. Close the table by clicking the red in the upper right-hand corner
of the window.
- Click on the Source tab at the bottom of the ArcMap Table of Contents. You should
see the Town_Wetland_Statistics table was added to the Table of Contents.
- Right-click on the Town_Wetland_Statistics table in the Table of Contents and
select Open from the menu that appears.
- The table should contain a value for the total number of wetland features and the
sum of their area in acres. This was computed using the Summary Statistics tool in
the last step of your model. Click the red in the upper right-hand corner of the
window to close the table.

Introduction to ModelBuilder Exercise 2 page 27


6. Update Model Properties

- Let’s add some finishing touches to our model. From your ModelBuilder Tools toolbox
in ArcToolbox, right-click on the model you just created (it should be named “Model”)
and select Properties from the dropdown window that appears. (Note: this is the
same Properties window that you can open by clicking the Model drop-down menu
item when using ModelBuilder’s editor.)

- On the General tab of the Model Properties window, change the model name to
“Exercise2”.

- Change the model label to “Exercise 2: Advancing MB Skills”.

- Under description, type a short paragraph describing the purpose of this model.

- Check “Store relative path names (instead of absolute paths)” at the bottom of
the window.

- Click OK to close the window. The name of your model should be changed in your
ModelBuilder Tools toolbox to reflect the new label you just gave it.

Introduction to ModelBuilder Exercise 2 page 28


LET’S REVIEW!
Congratulations! You have completed your second model in ModelBuilder. Let’s review some of
the concepts we covered in this exercise.

 Layers vs. Data Sets: Data layers are: stored in memory; deleted when the
application is closed; reference datasets stored on disk; specify how datasets are
displayed; allow features to be selected from a dataset; and are required as
inputs for certain geoprocessing tools. Datasets are: stored on disk and
permanent unless manually deleted. Examples of datasets include shapefiles,
geodatabase feature classes, and raster datasets.
 Locating Tools: Geoprocessing tools can be located using the Search and
Index tabs in ArcToolbox. The Index tab is useful when you know the exact name
of the tool, but not its location. The Search tab is handy when you know what
function you wish to perform, but are unfamiliar with the tool names and
locations.
 Tool Documentation: Tool documentation can be located through the ArcGIS
Help window which can be accessed by right-clicking on the tool name in
ArcToolbox and selecting Help from the menu that appears.
 Setting Intermediate files: When you run a model, output data is created for
each process in the model. Some of the data created is of no use after the model
is run and can simply be deleted after it has served its purpose. In ModelBuilder,
all derived data elements are automatically flagged as intermediate. You can
preserve these outputs by right-clicking on the element in the ModelBuilder
window and unselecting Intermediate.
 Add Output to Display: To add the data outputs to your ArcMap Table of
Contents, right-click on the data element in the ModelBuider window and select
Add to Display.
 Select tool: Extracts features from an input dataset or input layer and stores
them in a new output dataset. The output dataset may be created with a subset
of features based on a Structured Query Language (SQL) expression.
 Clip tool: Extracts input features that overlay the clip features. Works like a
“cookie cutter”. Use the Clip tool when you want to cut out a piece of one dataset
using one or more of the features in another.
 Add Field tool: Adds a field to a table in a dataset or layer.
 Calculate Field tool: Calculates values for a field in a dataset or layer.
 Summary Statistics tool: Calculates summary statistics for field(s) in a table.

This concludes Exercise 2.


Save your ArcMap project in your
C:\ModelBuilder\Projects folder as MyEx2.mxd

If you find yourself with extra time and would like to challenge
yourself, go on to Exercise 2: Extra Credit.

Introduction to ModelBuilder Exercise 2 page 29


Exercise 2: Extra Credit
If you blasted your way through Exercise 2 and are ready for more, then try this “Extra Credit”
exercise that builds on what you just completed. In this brief exercise, you will create a new
model, copy the contents from the previous model into it (so your Exercise 2 model doesn’t get
modified) and then add some additional functions to create wetland review areas (buffers) around
the wetland polygon features. If you have an ArcInfo license on the PC that you are working on,
you can also add a Frequency Analysis tool to the model to calculate the area of wetlands by
wetland type.

1. Create a New Model and Copy Elements from another Model to It


This step will let you populate a new model with elements from an existing model. This will keep
the original intact while you make modifications to a copy. This way if you get hopelessly messed
up you can always go back to the original.

- Open ArcMap and open the mxd named MyEx2.mxd which you saved in
C:\ModelBuilder\Projects.
- Right-click on the ModelBuilder Tools toolbox, hover over New and then select
Model from the pop-up menu. This will create a new empty model.
- Right-click on the model named Exercise 2: Advancing MB Skills and click on Edit
to open the model in the model editor window.
- Click on the Full Extent icon on the ModelBuilder toolbar to display all of the
model’s elements.

- Click on the Select Elements tool on the ModelBuilder toolbar and then drag a
box around all the elements in the model named Exercise 2: Advancing MB Skills.
Optionally, you could click the Edit drop-down menu item and then click on Select
All.

- Click the Copy button on the ModelBuilder toolbar to copy the entire model to the
clipboard.

- Move the mouse into the new model and click the Paste button on the
ModelBuilder toolbar to paste all of the elements into the new model.
- Close the model named Exercise 2: Advancing MB Skills.

2. Add the Frequency Tool to the Model (only available with the ArcInfo license)
- From ArcToolbox, expand the Analysis Tools toolbox and the Statistics toolset.
Click on the Frequency tool and drag and drop it into the ModelBuilder window. This
tool will allow you to calculate summary statistics for the acres field in your wetland
soils layer for each wetland class.

- Use the Connect Elements tool to connect the Town_Wetland_Area.shp (3)


element to the Frequency tool in the ModelBuilder window. In the Select Parameter
window that appears, click Input Table (Parameter) and click OK.
- Double-click on the Frequency element in the display window.

Introduction to ModelBuilder Exercise 2 page 31


- The Input Table should be Town_Wetland_Area.shp (3).

- Click the yellow folder icon under Output Table and navigate to your
C:\ModelBuilder\Data\ModelResults folder. Name the output
Town_Wetland_Area_Frequency.dbf.
- In the Frequency Field(s) list, check the CTWET field.
- In the Summary Field(s) (optional) list, check Acres.
- Click OK to close the Frequency dialog window.

3. Add the Buffer Tool to the Model


- In ArcToolbox in the Analysis Tools toolbox expand the Proximity toolset. Click on
the Buffer tool and drag it into the ModelBuilder window so it is near the element
Wetland_Soils_Clip.shp.

- Use the Connect Elements tool to connect Wetland_Soils_Clip.shp to the


Buffer element. In the Select Parameter window that appears, click Input Features
(Parameter) and click OK.
- Double-click on the Buffer element in the display window.
- The Input Features should be Wetland_Soils_Clip.shp.

- Click the yellow folder icon under Output Feature Class and navigate to your
C:\ModelBuilder\Data\ModelResults folder. Name the output
Wetland_Soils_Buffer.shp and click the Save button.
- In the Linear unit box enter 100 and make sure the units to the right is set to Feet.
- In the Dissolve Type (optional) box, select ALL.
- Click OK to close the Buffer dialog window.
- Right-click on the elements named Wetland_Soils_Buffer.shp,
Town_Wetland_Statistics.dbf and Town_Wetland_Area_Frequency. dbf and
make sure Add To Display is checked.

New Elements

Introduction to ModelBuilder Exercise 2 page 32


4. Set the Model Properties

- Click the Save button on the ModelBuilder toolbar to save all changes to your
model.
- Click the Model menu item and click on Model Properties…
- On the General tab of the Model Properties window, change the model name to
“Exercise2a”.
- Change the model label to “Exercise 2: Extra Credit”.
- Under description, type a short paragraph about the purpose of this model.
- Make sure “Store relative path names (instead of absolute paths)” at the bottom
of the window is checked.
- Click OK to close the window. The name of your model should be changed in your
ModelBuilder Tools toolbox to reflect the new label you just gave it.

5. Run the Model

- Before running the model, you should validate it. Click the Model menu item and
click on Validate Entire Model.

- Click the Run icon on the ModelBuilder toolbar to run the tool.

Sometimes when you run a model, especially after you have


already run it several times, you may get an error reported in the
geoprocessing message box. One particularly vexing error is:

Cannot get exclusive schema lock. Either being edited or in use


by another application.
If you encounter this error, close the message window, save
your model, save the ArcMap mxd, close and then reopen
ArcMap, Edit the model, Validate Entire Model and then Run
the model.

- After the model runs, you should have two layers added to ArcMap’s Table of
Contents:
- Wetland_Soils_Buffer
- Town_Wetland_Area
- (Note: you also may have Wetland_Soils_Clip in the Table of Contents. If
so, right-click on it and select Remove.)
- In the ArcMap Table of Contents, drag Wetland_Soils_Buffer to the bottom of the
list so you can see the buffered areas with the wetland soils and waterbodies above.

Introduction to ModelBuilder Exercise 2 page 33


6. Other Processes to Add to the Model
The types of geoprocessing steps that can be added to models probably is only limited by your
imagination. Think about some other ways that a models could be used to explore data and/or to
standardize data processing workflows. List yours ideas below.

This concludes Exercise 2a.


Save your ArcMap project in your
C:\ModelBuilder\Projects folder as MyEx2a.mxd\

Close ArcMap.

Introduction to ModelBuilder Exercise 2 page 34


Exercise 3: Building an Iterative Model
ModelBuilder has the ability to execute a model or process repeatedly for different data inputs
using a method called iteration. In ModelBuilder, there are several methods that will cause a
process or model to iterate. In this exercise, you will create a model that uses a List variable and
a Series variable. A List variable contains multiple datasets that serve as inputs to a model
process. When a List variable is connected to a tool, that tool and all subsequent processes will
be executed for every value in the list. A Series variable also contains multiple values. It differs
from a List, however, because the values in a Series are run for the entire model. Declaring
Series variables allows a user to run the tool for multiple input values. An example of a Series
input value may be a town name or watershed number. The model will execute all processes for
every value in the Series and create unique outputs. In the following exercise, you will create a
model that clips three statewide datasets to the boundaries of three different towns in
Connecticut. The town name will serve as the Series variable and the List variable will contain the
statewide datasets to be clipped.

List Variable
(statewide data) HuskyPC 1/16/08 1:42 PM
Series Variable List Variable Formatted: Font:Not Bold
(town names) outputs
HuskyPC 1/16/08 1:41 PM
Formatted: Font:Not Bold

The model produces outputs for each


item in the list (surficial materials, lakes,
and leachate and wastewater disposal
sites) and for each item in the series
(towns of Cheshire, Haddam and
Andover).

Introduction to ModelBuilder Exercise 3 page 35


1. Create a New Model
- Open ArcMap as a new empty map.

- Right-click on ArcToolbox and click on Add Toolbox…

- Navigate to C:\ModelBuilder\Toolboxes and select ModelBuilder Tools.

- In ArcToolbox, right-click on your ModelBuilder Tools toolbox and select New >
Model.

- From the ModelBuilder Main Menu, click on Model > Model Properties.

- Click on the General tab in the Model Properties window. Under Name: type
Exercise3. Under Label: type Exercise 3: Series and Lists. Check the box next to
Store relative pathnames. Click OK to close the window.

- Click the Save icon on the ModelBuilder toolbar to save your updated model
name.

- In ArcToolbox, locate the Make Feature Layer tool. Use the Index or Search tabs if
you can’t remember which toolbox it is located in.

- Click and drag the Make Feature Layer tool into the ModelBuilder interface.

- In ModelBuilder, double-click on the Make Feature Layer element to open the tool’s
dialog window.

- Click on the yellow folder icon under Input Features and browse to your
C:\ModelBuilder\Data\Shapes folder and select TOWNS.shp. Click Add to add it to
the Input Features field.

- Be sure the Output Layer is called TOWNS_layer and click OK to close the window.
Note that the input feature class is automatically added to your model and connected
to the Make Feature Layer tool.

2. Create a Series Variable


- In order to create a Series variable for town name, we will have to make a variable
from the Expression function. To do this, right click on the Make Feature Layer and
select Make Variable > From Parameter > Expression. This will add an
Expression variable to your ModelBuilder interface.

Introduction to ModelBuilder Exercise 3 page 36


- Use your Select Elements tool to move the Expression variable above the Make
Feature Layer element in your ModelBuilder window.

- Double-click on the Expression element to open its dialog window.

- Click on the SQL icon under Expression to open the Query Builder. This will
allow you to create a query to select a specific town. Build the following query using
the Query Builder: “TOWN” = ‘Haddam’

1. Double-click
HuskyPC 12/28/07 10:47 AM
Formatted: Font:9 pt

2. Single-click
HuskyPC 12/28/07 10:48 AM
Formatted: Font:9 pt

3. Single-click 4. Double-click
HuskyPC 12/28/07 10:48 AM
Formatted: Font:9 pt
HuskyPC 12/28/07 10:48 AM
Formatted: Font:9 pt

- Click OK to close the Query Builder window.

- Click OK to close the Expression window.

Your Expression variable should now be shaded, indicating that it is in a ready-to-run state. The
next step will be to set the Expression variable as a Series variable and add additional towns to
the Series.

Introduction to ModelBuilder Exercise 3 page 37


- Right-click on the Expression element in the ModelBuilder window and select
Properties from the menu that appears.

- Click on the General tab. Under This variable contains: click on the radio button
next to A series of values. Click OK to close the Expression Properties window.

- Notice that your Expression


variable has now become a
“stacked” element. This indicates
that it can contain multiple values.

- Double-click on the Expression


element in your model. Notice that
the Expression window has
changed. It is now a batch grid,
set up to allow you to specify
more than one input value. Each
value in the Series is represented
by a row. Because we have only
specified one town, there will only
be one row.

- Click the Add button on the


right side of the window and add
two more rows. We are going to
create a Series containing three
town name values. Because it is a
Series, this will run the entire
model for every value we add.

Introduction to ModelBuilder Exercise 3 page 38


- Click in the first row in the batch grid. The expression you previously created in this
exercise to select the town of Haddam should be present in this row. Use your mouse
to select the entire expression. With the expression selected, use your keyboard
controls to copy (Ctrl) C and paste (Ctrl) V the expression into the two empty rows.
All three rows should be populated with the expression “TOWN” = ‘Haddam’.

- Click in the second row. Change ‘Haddam’ to ‘Cheshire’.

- Click in the third row. Change ‘Haddam’ to ‘Andover’.

Your Expression window should look like the graphic below. Copying and pasting a query that
was created using the Query Builder is the safest and most reliable method for ensuring that the
queries in the additional rows do not include syntax errors.

- Click OK to close the Expression window.

- In the ModelBuilder window, right-click on the Town_Layer element and select Add
to Display from the menu that appears.

- Click the Save icon on the ModelBuilder toolbar to save your changes.

3. Create a List Variable


In this step, you will use the Clip tool to clip several statewide datasets to the boundaries of the
three towns in the Series. In order to have multiple data inputs to the Clip tool, we will use a List
variable.

- In ArcToolbox, locate the Clip (analysis) tool. Use the Index and Search tabs to find
the tool if you don’t remember where it is located.

- Drag and drop the Clip tool from ArcToolbox into your model.

Introduction to ModelBuilder Exercise 3 page 39


- Click on the Add Data icon on the ModelBuilder toolbar. Navigate to your
C:\ModelBuilder\Data\Shapes folder and add SURFMAT.shp to your model.

- Use the Select Elements tool to position the data element next to the Clip tool in
your ModelBuilder interface.

- Click on the Connect Elements tool on the ModelBuilder toolbar.

- Click on SURFMAT.shp and drag the connector to the Clip tool. In the window that
appears, select Input Features (Parameter) and click OK.

- Using the Connect Elements tool, click on the TOWNS_Layer element and drag the
connector to the Clip tool. In the window that appears, select Clip Features
(Parameter) and click OK.

All elements in your model should now be shaded, indicating that they are in the ready-to-run
state. Before we run the model, let’s create a List variable from the Input Features for the Clip
tool. This will allow us to add additional values (datasets) which will serve as inputs to the Clip
element.

- Right-click on the SURFMAT.shp element in your model and select Properties from
the menu that appears.

- On the General tab, under This variable contains:, click the radio button next to A
list of values.

- Click OK to close the SURFMAT.shp Properties window.

- Notice that your SURFMAT.shp variable has now become a “stacked” element. This
indicates that it can contain multiple values. Also notice that the Output Feature
element also contains multiple values.

Introduction to ModelBuilder Exercise 3 page 40


- Double-click on the SURFMAT.shp element to open its dialog window. Notice that
like the Series variable, the properties window is now a batch grid, set up to allow
you to specify more than one input value. Each value in the List is represented by a
row. Because we have only specified one input data, SURFMAT.shp, there will only
be one row in the grid.

- Click the Add button on the right side of the window and add two more rows. We
are going to create a List containing three datasets that will serve as inputs to the
Clip tool. Because it is a List, the tool will be run for every value we add.

- Right-click in the white space in the second row and select Browse from the menu
that appears. Navigate to your C:\ModelBuilder\Data\Shapes folder and select
LAKE.shp. Click Add to add the pathname to the second row.

- Repeat this for the third value in the list. This time add LWDS.shp (leachate and
wastewater disposal sites) from your C:\ModelBuilder\Data\Shapes folder.

- Click OK at the bottom of the SURFMAT.shp window when you have completed the
list.

- Click the Save icon on the ModelBuilder toolbar to save changes to your model.

Introduction to ModelBuilder Exercise 3 page 41


4. Setting Iteration Variables
Before running your model, you will have to add one more feature to the model, iteration
variables. Iteration variables prevent ModelBuilder from overwriting the outputs of each model
iteration as it repeats model processes for each dataset in a List or Series.

ModelBuilder provides two variables that represent the current model iteration number (%n%)
and the current position, or index, in a list variable (%i%). By placing %i% and %n% in the
filename for model outputs, you will prevent datasets from being overwritten. For example, the
pathname for one of your output datasets will be:
C:\ModelBuilder\Data\ModelResults\Lake%i%_%n%.shp. Based on the iteration variables
included in the pathname, the datasets that would be created after this model is run will be
Lake_1_0.shp; Lake_1_1.shp; and Lake_1_2.shp. The first number in the output represents the
position of the town for which the lake features are clipped in the Series variable. The second
number represents the position of the LAKE.shp input layer in the List variable. This will all make
sense once you run your model. You will use iteration variables in the last step of this exercise to
create unique outputs for the datasets clipped to each town in the model series.

- Double-click on the Clip element in your model to open the tool’s dialog window.
Instead of the typical dialog window, you will see a batch grid. Remember, this is
because we created a List variable from the input data layer for this tool.

- Expand the window so that you can see the Output Feature Class column in the
batch grid.

- Under the Output Feature Class heading, right-click in the cell in the first row and
select Browse from the menu that appears. Navigate to your
C:\ModelBuilder\Data\ModelResults folder. Name the output
Surfmat_%i%_%n%.shp. Click Save to close the browse window.

- Under the Output Feature Class heading, right-click in the cell in the second row
and select Browse from the menu that appears. Navigate to your
C:\ModelBuilder\Data\ModelResults folder. This time name the output
Lake_%i%_%n%.shp. Click Save to close the browse window.

- Repeat the process a third time, this time changing the pathname for the output
feature in the third row. Save the output as lwds_%i%_%n%.shp in your
C:\ModelBuilder\Data\ModelResults folder.

- After you have updated the Output Feature Class filenames, click OK to close the
Clip tool’s dialog window.

- Right-click on your Output Feature Class element in the ModelBuilder window (it will
be called Surfmat_%i%_%n%.shp) and select Add to Display.

- Click the Save icon on the ModelBuilder toolbar to save changes to your model.

Introduction to ModelBuilder Exercise 3 page 42


5. Set the Iteration Count
You’re almost ready to run your model. The last step is to tell ModelBuilder how many iterations
to execute. The iteration count is set through the Model Properties window.

- Click on Model from the ModelBuilder Main Menu and select Model Properties from
the menu that appears.

- In the Exercise 3: Series and Lists Properties window, click on the Iteration tab.

- Click the drop-down arrow under Get the iteration count from this variable and
select Expression. This tells ModelBuilder to repeat the entire model based on the
number of values in the Expression Series variable. Because there are three values
in this variable (remember way back in step 2 when you selected three towns), the
model will run three times consecutively, executing the two model processes (Make
Feature Layer and Clip) six times, once for each town.

- Click OK to close the Exercise 3: Series and Lists Properties window.

- Click the Save icon on the ModelBuilder toolbar to save changes to your model.

Introduction to ModelBuilder Exercise 3 page 43


6. Run Your Model
- You are now ready to run your model. Click
the Run icon from the ModelBuilder toolbar.
Notice the geoprocessing dialog window
specifies six model processes instead of just
two.

- After your model has been run, click Close to


exit the geoprocessing message window.

- Close the ModelBuilder window. If ArcMap


asks you to save your changes, select Yes.

Take a minute to view the output datasets that were added to the Table of Contents. Notice that
the first number in the output name is unique to the clipped dataset in the List (Surfmat, Lake, or
LWDS) and the second number is unique to the town (Haddam, Cheshire, or Andover) in the
Series.

Introduction to ModelBuilder Exercise 3 page 44


LET’S REVIEW!
Bingo! You have just completed your third model in ModelBuilder. And this one was a bit more
complex. You created variables that can be used to store series and lists and used them to run
all or part of a model multiple times thereby making the model perform a lot more work than if it
just ran once. Let’s review some of the concepts we covered in this exercise.

 Exposing an Expression Variable: In the model you initially used a Make


Feature Layer tool to select a single town from a feature class that contained
many town polygons. The SQL used to select a town was entered into the tool.
You then exposed this as a variable and an expression element was added to
the model diagram.
 Creating and Using a Series Variable: You changed the properties of the
exposed expression variable and identified it as a series of values. Series
variable cause the entire model to run once for each value in the series variable.
You used this series variable to select three towns that you want to use as clip
layers to a clip operation.
 Creating and Using a List Variable: In the exercise you added a statewide
feature class of Surficial materials (Surfmat.shp) as an input layer to a clip
operation. You then changed the properties of the input layer and declared it to
be a list variable. You then updated the values of the list variable to include three
statewide feature classes that would be clipped using the three towns identified
in the series variable. With list variable, the tool connected to the list and all
dependent downstream processes will execute once for each value in the list.
 Using Iteration Variables: ArcMap uses two special variables to track list and
series variables. These are %i% and %n%. These values can be used to help
name output feature classes and to prevent datasets from being overwritten.
 %i% = the index or list variable; the first count is zero.
 %n% = the model iteration number; the first iteration is zero.
 Setting and Using an Iteration Count: When you use a series in a model, you
also must establish how many times the model will execute for the series
variable. This can be a number, a variable or the series count. In the exercise,
you set the iteration count to be equal to the number of towns that were entered
in the series variable.

This concludes Exercise 3.


Save your ArcMap project in your
C:\ModelBuilder\Projects folder as MyEx3.mxd

Close ArcMap.

Introduction to ModelBuilder Exercise 3 page 45


Exercise 4A: Creating a Generic Model
One of the most useful aspects of ModelBuilder is the ability to build generic tools that can be
reused and shared. Models that are built as a generic tool can be opened and run from
ArcToolbox and allow the user to supply input data, parameters and output specifications before
the model is run. Below is an example of a generic model. Notice that none of the processes are
shaded, indicating that they are not ready-to-run. This is because the parameters must be
entered into the tool’s dialog window at run time.

Generic Model in ModelBuilder window

Dialog Window

In this exercise, you will transform the model you created in Exercise 2 into a generic model that
can be shared with other users and that can accept different input data sources. Additionally, you
will document the model and model processes to create a more user-friendly product. Let’s get
started!

1. Opening ArcMap
To start the ArcMap application, double click with the left mouse button on the ArcMap shortcut

on the desktop. If there is no shortcut, then start the program by clicking on


Start>Programs>ArcGIS>ArcMap. It may take awhile for ArcMap initially to open so be patient.

When ArcMap first opens, you will see a window that asks if you want to open A new empty
map, A template or An existing map.

Make sure that “An existing map” is selected and browse to your C:\ModelBuilder\Projects
folder and Open your MyEx2.mxd.

Introduction to ModelBuilder Exercise 4A page 47


2. Create a New Model
In this step, you will copy and paste the model that you created in Exercise 2 and paste it into a
new, empty model. This will preserve your original model and allow you to use the tools and
processes from Exercise 2 in your new generic model.

- In ArcToolbox, expand your ModelBuilder Tools toolbox.

- Right-click on your Exercise 2: Advancing MB Skills model and select Edit from
the menu that appears.

- Maximize the ModelBuilder window or use the Zoom to Full Extent function so
that you can view the entire model in the window.

- From the ModelBuilder Main Menu, click Edit > Select All from the drop-down menu.
This should select all of the elements within your model.

- From the ModelBuilder Main Menu, click Edit > Copy from the drop-down menu.
This will copy all of the elements within your model.

- Close your Exercise 2: Advancing MB Skills model.

- In ArcToolbox, right-click on your ModelBuilder Tools toolbox and hover over New
and select Model from the menu that appears. This should create a new model in
your toolbox and open it in the ModelBuilder window.

- In the ModelBuilder window, click Edit > Paste. This should paste all of the elements
from your Exercise 2 model into the new model. Maximize the window or select
Zoom to Full Extent to verify that all of the elements were copied into your new
model.

Note: Your model should contain all the elements shown above:
however, they may be arranged differently depending on how
you laid things out.

Introduction to ModelBuilder Exercise 4A page 48


3. Create Parameters from Model Variables
Remember, a model is simply a tool. When a model is opened from the tool dialog window in
ArcMap or ArcCatalog, any variable that has been exposed as a parameter in the ModelBuilder
interface will be visible in the dialog window. The user can then interact with these tool settings.
Parameters allow the user to control model inputs, tool settings, and output file locations by
entering a value, selecting from a dropdown list, or providing data pathnames.

- In ModelBuilder, right-click on the Select element. In the menu that appears, select
Make Variable > From Parameter > Expression. This will add an additional input to
the Select tool in the form of an Expression element.

- Use the Select Elements tool on the ModelBuilder toolbar to reposition the
Expression element above the Select tool.

- Double-click on the Expression element to open its properties window. Notice that
the SQL expression that you define in Exercise 2 is populated in the Expression
window of this element. Delete it and click OK to close the window.

- Right-click on the Expression element and select Rename from the menu that
appears.

- Rename the element “Select Town” and click OK.

- Right-click on the Select Town element and click Model Parameter from the menu
that appears. You should now see a small “P” above the model element, identifying
the element as a parameter. It also added the Select Town expression variable to
the model’s dialog interface, allowing the user to enter an SQL expression to select
the town of their choice. Let’s see how this works.

- Save your model. Click the red in the upper right-hand corner of the
ModelBuilder window to close the model.

Introduction to ModelBuilder Exercise 4A page 49


- In your ModelBuilder Tools toolbox, right click on Model and select Open from the
menu that appears. You should see your new model parameter, Select Town, visible
from the model dialog window. The SQL icon under Select Town allows the user to
use the Query Builder to select a town without having to open the ModelBuilder
interface.

- Click Cancel at the bottom of the Model dialog box (if you were to click OK, the
model would run).
- Right-click on Model in your
ModelBuilder Tools toolbox and
select Edit to return to the
ModelBuilder edit window. We still
have several parameters to create
before the model can be shared with
others.
- Right-click on the Make Feature
Layer element and select Make Variable > From Parameter > Expression from the
menu that appears.

- Use the Select Elements tool to reposition the Expression element below the
Make Feature Layer tool.
- Double-click on the Expression element to open its properties window. Notice that
the SQL expression that you define in Exercise 2 to select wetland soils is populated
in the Expression window of this element. Delete the expression and click OK to
close the window.

- Right-click on the Expression element and select Rename from the menu that
appears.

- Rename the element “Select Soil Type” and click OK.

- Right-click on the Select Soil Type element and click Model Parameter from the
menu that appears. You should now see a small “P” above the model element,
identifying the element as a parameter. The Select Soil Type expression variable
was also added to the model’s dialog interface, allowing the user to enter a SQL
expression to select the soil attributes of their choice to process in the model.

- Click the Save icon on the ModelBuilder toolbar to save your model. Click the red
to close the ModelBuilder interface.

Introduction to ModelBuilder Exercise 4A page 50


- Let’s check to be sure your second parameter was added to the tool’s dialog window.
Right-click on Model in your ModelBuilder Tools toolbox in ArcToolbox and select
Open from the menu that appears. You should now have two parameters in your
Model dialog window, Select Town and Select Soil Type. The user has the ability to
specify a specific input using the Query Builder. This adds flexibility to the model by
allowing the user to control inputs from the dialog window rather than the
ModelBuilder interface.
These SQL parameters are certainly useful, but several other parameters will need to be
added to produce a completely generic model. Because the user will likely have different
input datasets and will want to store their outputs in specific locations, we want to create
generic input and output elements. We can do this by exposing these model elements as
parameters and deleting the pathnames that were used when you created the model in
Exercise 2.
- Click Cancel to close the Model dialog window.
- Right-click on Model in your ModelBuilder Tools toolbox and select Edit from the
menu that appears.
- Right-click on the input element for the Select tool, TownsMiddlesexCounty.shp,
and select Model Parameter from the menu that appears.
- Double-click TownsMiddlesexCounty.shp to open its properties window. Under
TownsMiddlexCounty.shp, delete the pathname to the dataset and click OK to
close the window.

- Right-click on the TownsMiddlesexCounty.shp element one more time and select


Rename from the menu that appears. Rename the element “Input Towns” and click
OK to close the window.
- Click the Save icon on the ModelBuilder toolbar to save your model updates.
- Right-click on the input element for the Make Feature Layer tool,
middlesexsoils.shp, and select Model Parameter from the menu that appears.
- Double-click middlesexsoils.shp to open its properties window. Under
middlesexsoils.shp, delete the pathname to the dataset and click OK to close the
window.

Introduction to ModelBuilder Exercise 4A page 51


- Right-click on the middlesexsoils.shp element again and select Rename from the
menu that appears. Rename the element “Input Soils” and click OK to close the
window.

- Click the Save icon on the ModelBuilder toolbar to save your model updates.
- Now let’s give the output datasets a generic name as well. Right-click on
Town_Wetland_Area.shp and select Model Parameter from the menu that
appears.
- Double-click Town_Wetland_Area.shp to open its properties window. Under
Town_Wetland_Area.shp, delete the pathname to the dataset and click OK to close
the window.
- Right-click on the Town_Wetland_Area.shp element and select Rename from the
menu that appears. Rename the element “Wetland Layer (Output Feature Class)”.
Click OK to close the window. Save your model.
- Let’s add one more model parameter. Right-click on Town_Wetland_Statistics.dbf
and select Model Parameter from the menu that appears.
- Double-click Town_Wetland_Statistic.dbf to open its dialog window. Under
Town_Wetland_Statistic.dbf, delete the pathname to the dataset and click OK to
close the window.
- Right-click on the Town_Wetland_Statistic.dbf element and select Rename from
the menu that appears. Rename the element “Total Area of Wetlands (Output
Table)”. Click OK to close the window. Save your model.
Congratulations! Your generic model is almost complete. Before we use it however, we want to
specify the order in which the parameters will appear in the tool’s dialog window. ModelBuilder
adds parameters to the dialog window based on the order in which they were created. This may
not be the most logical order; therefore we will manually arrange them.
- In the ModelBuilder interface, click on Model from the Main Menu and select Model
Properties.
- Click on the Parameters tab.
Notice that the list reflects the order in which the parameters were created in the previous
steps. In order to make it intuitive to the user, let’s rearrange the order.
- Click on the Input Towns parameter to select it
and click the arrow twice to move it to the
top of the list.
- Next click the Input Soils parameter and move
it above Select Soil Type.
- Your parameters should now be in the correct
order. Use the graphic below to verify their
order. Remember, this is important because this
list reflects the order in which these parameters
will appear in the tool’s user interface.

Introduction to ModelBuilder Exercise 4A page 52


- Click OK to close the window.
- Click the Save icon on the ModelBuilder toolbar to save all of the changes you made
to your model.
- Click the red in the upper right-hand corner of the window to close the model.
- Right-click on Model in your ModelBuilder Tools toolbox and select Open. This will
open the tool’s dialog window.

Notice your model now has six parameters listed in logical order. The user has the ability to
control the model inputs, selection queries, and location of output datasets from the dialog
window. Parameters eliminate the need for a user to open the ModelBuilder interface and add
flexibility to the tool, allowing users to share the model and adjust it for their specific needs.

- From the tool’s dialog window, click on the Show Help>>> icon on the lower right-
hand corner. This will expand the tool’s help window.
- Click on each of the tool parameters in the Model dialog window. Notice that the help
text changes as you click on each parameter. In the next series of steps, you will
learn how to add documentation to your model which will be available in the Help
window of the tool’s user interface.
- Click Cancel to close the Model dialog window.
- Right-click on Model in your ModelBuilder Tools toolbox and select Rename from the
menu that appears. Let’s give your generic model a more descriptive name.
- Rename the model Exercise 4: Clipping Town Wetlands.

When you have completed this exercise, go onto Exercise 4B which will
take you through the process of adding documentation to this model.

Introduction to ModelBuilder Exercise 4A page 53


Exercise 4B: Adding Documentation to a Model
If your intention is to share your model with others, providing good tool documentation is
essential. Even if your tools are not going to be distributed, adding documentation to a model is a
good idea and will help you manage your tools, especially once you start filling up your toolboxes
with multiple models!
Model tools are documented using the same system the ESRI developers use to document
system tools. The Documentation Editor allows you to enter general information about your model
including a summary of the tool, keywords, author contact information, model constraints, usage
tips, parameter descriptions, and more. This information can be critical when providing a user
with a model that they are unfamiliar with. Just think about how many times you use the Help
associated with system tools to determine if they are appropriate for your project application!
In this exercise you will create documentation for the generic model you created in Exercise 4A.
The exercise will take you through the basics of the Documentation Editor. When you have
completed this exercise your generic model will be ready to share with others!

1. Exploring the ArcToolbox Documentation Editor


- Right-click on the generic model you created in the last exercise, Exercise 4:
Clipping Town Wetlands, and select Edit Documentation from the menu that
appears. This will open the ArcToolbox Documentation Editor.
- The Documentation Editor consists of two
sections: The Table of Contents, which lists
available help elements and the Contents
Panel, where text can be entered for each help
element. Take a minute to familiarize yourself
with the Documentation Editor by clicking
through each element. Also, refer to the table on
the next page for a description of each help
element and where it will appear in the tool’s
documentation.

All elements under


General Information
are shown in the
metadata for a tool.

All elements under


Help are shown in the
reference page for a
tool.
Contents panel
The Abstract and Table of
Parameters elements Enter Text for
are also included in the Contents help elements
side-panel help which Lists help
is visible in the tool’s elements
dialog window.

Introduction to ModelBuilder Exercise 4B page 55


Help Element Description of Help Element
The abstract provides a brief overview describing the purpose of the tool. It can
Abstract only contain one paragraph of text and will be visible in the side-panel of the
dialog window when the tool is opened from ArcToolbox or ArcCatalog.

Keywords are searched from the Search Tab in ArcToolbox. Enter any useful
Keywords
terms that apply to the functionality of your tool.
Author Enter contact information for the author of the tool.

Constraints refer to access, use, and security constraints. Include all permitted
Constraints uses, warnings, copyright information and company policies in the constraints
element.

The summary is similar to the abstract in that it contains an overview of the


Summary purpose of the tool. Text will only appear on the reference page for the tool. The
summary is edited using the page editor.
Add information for the user about each tool parameter. For each parameter
there are two categories of help text: command reference which will be
Parameters displayed on the tool’s reference page; and dialog reference which will be
displayed in the side-panel of the tool’s dialog window. Each parameter is
documented separately using the page editor.

Provides information for the user about how the tool should be used. This
Usage information is documented using the page editor and is displayed on the tool’s
reference page.
This is an illustration depicting the operations performed by the tool. You can
Illustration enter a pathname to a graphics file that contains the illustration. This information
is displayed on the reference page for the tool.
Metad ata
Add an example here of how the tool is used in command line. This will be
Command Example
displayed on the tool’s reference page.Reference page
Add an example of how the tool is used in a script. This will be displayed on the
Script Example
tool’s reference page.

Side-panel of
tool’s dialog
window

Introduction to ModelBuilder Exercise 4B page 56


2. Adding Metadata Documentation to Your Model
Now that you are familiar with the Documentation Editor, let’s add some documentation to your
model. We’ll add text to several elements in the table of contents in order to demonstrate how
they are applied to the model documentation and help files associated with your tool. In this step,
we’ll edit the General Information documentation. All documentation entered for the General
Information contents will appear in
the metadata for your model.
- In the ArcToolbox
Documentation Editor
Table of Contents,
click on Abstract. In the
contents panel, type a
short abstract that
covers the purpose of
your model.
- Next, click on
Keywords in the table
of contents. Enter one
or two descriptive words
relating to your model.
To add keywords, use
the icon or click in
the white space and begin typing.
- Click on Author in the table of contents and add your contact information to the
contents panel.
- Lastly, click on Constraints. This is where you would enter any access, usage, or
security constraints for your tool. This model has a particular usage constraint
because it assumes the input data is in units of feet. It uses the area calculation in
feet to calculate the area in acres during one of the last steps in the model. This
would be an appropriate place to make note of this assumption.
- When you have completed the General Information portion of the Documentation
Editor, click Finish. This will close the ArcToolbox Documentation Editor.
- From the ArcMap Standard Toolbar, click on
the Launch ArcCatalog icon. This will open
ArcCatalog on your desktop.
- In ArcCatalog, browse to your
C:\ModelBuilder\Toolboxes folder in the
Catalog Tree. Expand your ModelBuilder
Tools toolbox and click on Exercise 4:
Clipping Town Wetlands model.
- Click on the Metadata tab. You should see the
Abstract, Keywords, Author, and Constraints
information you just entered displayed in the
metadata for the model.
- Once you are finished examining the metadata,
click the red in the upper right-hand corner of
the window to close ArcCatalog.

Introduction to ModelBuilder Exercise 4B page 57


3. Adding Documentation to the Tool’s Dialog Window
Let’s return to ArcMap and compete the model documentation for your Tool’s dialog window. The
documentation you enter for the Abstract and Parameter elements will be visible to the user when
they open the tool from ArcToolbox or ArcCatalog.
- If it isn’t already visible, maximize ArcMap.
- In ArcToolbox, expand your ModelBuilder Tools toolbox and right click on Exercise
4: Clipping Town Wetlands and select Edit Documentation from the menu that
appears. This should open the ArcToolbox Documentation Editor again.
- In the Documentation Editor Table of Contents, click on Parameters. On the right
side of the window, the Page Editor will appear. Notice that each of your parameters
is listed under Contents.
- Click on the + symbol to the left of Input towns. There will be two categories listed
under the parameter: Command Reference and Dialog Reference. For each
parameter there are two categories of help text: command reference which will be
displayed on the tool’s reference page; and dialog reference which will be displayed
in the side-panel of the tool’s dialog window. We will edit the dialog reference.
- Under the Input towns parameter, click on Dialog Reference. Click on the Add
Paragraph icon to add a new paragraph to the parameter’s documentation. You
should see the text window on the right change from grey to white, indicating that you
can now add text to the paragraph associated with the parameter. In the window,
type a brief description of. For example: “A dataset that contains the town
boundaries for your state or county”. This provides the user with a description of
the type of input data the model needs for this parameter.

2. 4. 5.
3.
1.

Once you have completed the description for the Input Towns parameter, add
paragraphs and text to the Dialog Reference items under each of the additional five
parameters. An outline of each parameter description is provided in the table below;
however feel free to add as much detail as you wish.

Introduction to ModelBuilder Exercise 4B page 58


Parameter Dialog Reference Paragraph
Input Towns Browse to a dataset that contains your town boundaries.

Select Town Click on the SQL icon to open Query Builder and create a query
to select a municipality of your choice.
Browse to a dataset containing soil polygons. This layer should
Input Soils include an attribute field containing soil types. For this model,
wetland soils should be defined in the attribute table.
Click on the SQL icon to open the Query Builder window. Enter
Select Soil Type a query that selects all wetland soils from the Input Soils data
layer.
This is your output which contains wetland soil polygons. It will
Wetland Layer (Output
get added to your ArcMap Table of Contents after your tool has
Feature Class)
run. Provide the pathname and layer name for this dataset.
This is a table output that contains the total area of wetland soils
in acres for the town you have selected. It will get added to the
Total Area of Wetlands
ArcMap Table of Contents after the tool is run. Because it is a
(Output Table)
table you will have to click on the Source tab to view it. Provide
the pathname and layer name for this dataset.

- When you have completed the Dialog Reference descriptions for each parameter,
click Finish at the bottom of the ArcToolbox Documentation Editor window.
- Let’s view our updated documentation. Text that gets added to the Abstract and
Parameters in the Documentation Editor will be added to the tool’s dialog window.
To view these changes, right-click on your Exercise 4: Clipping Town Wetlands
model in your ModelBuilder Tools toolbox and select Open from the menu that
appears. This will open the tool’s dialog window.
- If the Help is not already visible on the right side of the dialog window, click the Show
Help>>> button to expand the Help documentation associated with the model. You
should see the Help window appear containing the description you entered for the
model’s abstract.

Dialog window
Help panel

Introduction to ModelBuilder Exercise 4B page 59


- Next, click in the white space below the Input Towns parameter. You should notice
that the description you entered for this parameter now populates the Help window.
- Take a minute to click through each parameter and view the Help documentation you
have created for each one. The text you added to each parameter should be
descriptive enough to inform the user what the model’s purpose is and what kind of
data or input is expected for each of the tool’s parameters.
- After you have examined each parameter, click the Cancel button at the bottom of
the dialog window to close the tool.

4. Adding Documentation to the Tool’s Reference Page


Some of the Help elements contained within the ArcToolbox Documentation Editor will appear in
the tool’s Reference Page. The Reference Page is displayed when the user right-clicks on a tool
or toolbox and selects Help. It can also be accessed through the Help window of the tool’s dialog
box. Documentation can be added to the Reference page using tools in the Documentation Editor
or added in the ModelBuilder interface. In this step, you will experiment with both methods.

- In ArcToolbox, right-click on your Exercise 4: Clipping Town Wetlands model and


select Edit from the menu that appears. This will open the model in the ModelBuilder
interface. In ModelBuilder, you can add documentation to individual tool elements.
Any documentation you create will appear in the tool’s reference page.
- Right-click on the Add Field element in your model
and select Edit Documentation from the menu that
appears. This will open the Page Editor which will
allow you to enter text describing the tool’s function
within the model.

Introduction to ModelBuilder Exercise 4B page 60


- Click on the Add Paragraph icon on the Documentation toolbar to add a
paragraph under the Add Field documentation element.
- In the right-hand side of the window, type a description of the tool’s function. You can
use the text description in the graphic below as a guide.

- Once you have completed your paragraph, click on the Add Bulleted Item icon
on the Documentation toolbar. This will add a bulleted item under your paragraph in
the Reference Page.

- In the text editor


on the right, type
in Field Name =
Acres.

- Click the Add Bulleted


Item icon again. In
the text editor for your
second bullet, type Field
Type = FLOAT.
- Repeat this process two
more times, adding
additional bullets for
Field Precision = 8 and
Field Scale = 1. When
you have finished, you
should have one
paragraph and four bullet
items under your Add
Field element in the
Page Editor.

Introduction to ModelBuilder Exercise 4B page 61


- Click OK to close the Add Field Documentation window.

- From the ModelBuilder toolbar, click the Save icon to save your model. Close
ModelBuilder by clicking the red in the upper right-hand corner of the window.

Before we view the Reference Page for your tool, let’s return to the Documentation Editor. There
are several documentation elements that appear in the Reference Page that must be edited from
the Documentation Editor.
- In ArcToolbox, right-click on your Exercise 4: Clipping Town Wetlands model in
your ModelBuilder Tools toolbox and select Edit Documentation from the menu that
appears. This will open the ArcToolbox Documentation Editor.
The Documentation Editor should look familiar because you added text to the General
Information elements and the Parameters earlier in this exercise.

All elements under


Help are shown in the
reference page for a
tool.

Remember, any text added to the General Information elements will get added to the tool’s
metadata. Text added to the Abstract and Parameters will get added to the side-panel help in the
tool’s dialog window and text added to the Help elements will get added to the tool’s Reference
Page. In order to view a more complete Reference Page, let’s add documentation to some of the
Help elements in the Documentation Editor’s Table of Contents.

Introduction to ModelBuilder Exercise 4B page 62


The Summary documentation element is very similar to the Abstract with the exception that a
Summary can contain multiple paragraphs which describe your tool whereas the Abstract is
limited to one paragraph. In the interest of time, we’ll simply copy the Abstract text and paste it
into the Summary documentation.
- Click on Abstract in the Documentation Editor Table of Contents. You will see the
text that you entered for the Abstract appear in the text editor on the right. Use your
mouse to select the text. With the text selected, right-click and select Copy from the
menu that appears. Next, click on the Summary element in the Documentation
Editor Table of Contents. Click the Add Paragraph icon on the Page Editor toolbar
to add a new paragraph to the Summary element. In the text editor, right-click in the
white area and select Paste from the menu that appears. The text that you copied
should now appear in the Summary paragraph.

2.
1.

3.

- Let’s add one more item to the tool documentation. Click on Illustration in the
Documentation Editor Table of Contents.

- Click on the yellow folder icon under Path: and browse to your
C:\ModelBuilder\Data\Graphics folder and select Ex2.jpg. Click Open to add the
pathname to the graphic in the Documentation Editor. This will add an illustration of
the model output to the Reference Page.

Introduction to ModelBuilder Exercise 4B page 63


- Click Finish in the ArcToolbox Documentation Editor to save all of the changes
you made to the tool documentation. You are now ready to view the tool’s Reference
Page.
- The easiest method for
accessing a tool’s Reference
Page is to right-click on the tool
in ArcToolbox and select Help
from the menu that appears.
Try this for your Exercise 4:
Clipping Town Wetlands
model.
- You will notice the Summary
and Illustration you added to
the Documentation Editor
appear on the Reference Page.
Scroll down the page to Model
Elements. Notice the text that
was added next to the Add
Field tool. This was added from
the ModelBuilder interface.
- Close the Reference Page.

Another method for accessing the model’s Reference Page is from the tool’s dialog window.
- In ArcToolbox, right-click on your Exercise 4: Clipping Town Wetlands model and
select Open from the menu that appears. This will open the tool’s dialog window.
- In the dialog window, be sure
the side-panel is showing. If it is
not, click the Show Help>>>
icon to expand it.

- Notice the Help icon in


the upper left-hand corner of the
side panel. Click on it. This is
another method for opening the
tool’s Reference Page.

Congratulations! You have completed the documentation for this tool and are ready to share it
with others! Spend some time exploring all of the different documentation pages for your model. If

Introduction to ModelBuilder Exercise 4B page 64


you have extra time, add more text to the documentation elements. The more detailed the
documentation is, the easier it will be for others to use your tool.

Introduction to ModelBuilder Exercise 4B page 65


Some Important Notes Concerning ModelBuilder and Documentation:
Documentation should always be the LAST thing you add to your model.
Experience has uncovered a “glitch” in the ModelBuilder framework where any
documentation added to a model will be deleted upon changing a model in any
way. Documentation is an important feature of all geoprocessing tools and
should not be overlooked, however, it’s best to save it as a finishing touch!

You also should be sure that the model editor is closed before you add any
documentation other than tool element documentation. If the editor is open,
documentation added to the model will be lost when the model is saved – ouch!

5. Test out Your Generic Model


Now that you have created a well documented, sharable model, let’s test it out. In this final step,
you will run your generic tool from its dialog window and specify different inputs in the data fields.

- In ArcToolbox, right-click on your Exercise 4: Clipping Town Wetlands model and


select Open from the menu that appears. This will open the tool’s dialog window.

- Under Input Towns, click the yellow folder icon under and navigate to your
C:\ModelBuilder\Data\Shapes folder and select TownsMiddlesexCounty.shp.
Click Add.

- Under Select Town (optional), click the SQL icon to open the Query Builder.
Use the Query Builder to create a query to select any town in Middlesex County.
Click OK.

- Under Input Soils, click the yellow folder icon and navigate to your
C:\ModelBuilder\Data\Shapes folder and select middlesexsoils.shp. Click Add.

- Under Select Soil Type (optional), the SQL icon to open the Query Builder.
Use the Query Builder to create the following expression: “CTWET” <> ‘Non-
wetland soils” (remember to use the icon, not < and > separately). Click OK.

- Under Wetland Layer (Output Feature Class), click the yellow folder icon and
navigate to your C:\ModelBuilder\Data\ModelResults folder and type in “Town
Name”_wetland_layer.shp. “Town Name” refers to the name of the town you
selected in the Select Town query. This will be your output layer that contains
wetland polygons for the town that you have selected. Click Save.

- Under Total Area of Wetlands (Output Table), click the yellow folder icon and
navigate to your C:\ModelBuilder\Data\ModelResults folder and type in “Town
Name”_wetland_statistic.dbf. Again, “Town Name” refers to the name of the town
you selected in the Select Town query. This will be the table that contains the total
area of wetland soils in acres for the town you have selected. Click Save.

Introduction to ModelBuilder Exercise 4B page 66


- Verify that all of your data requirements, selection queries and output pathnames are
valid. If there is a problem, ArcMap will insert a red to indicate that there is an
issue with one of your entries. You can click on it to get a better description of the
problem and fix it accordingly.
- Once you are satisfied with your
entries, click OK to run the tool.
The geoprocessing window will
open while the model is
executing. If ArcMap encounters
any errors, they will be listed in
the window.
- Once the model has been
executed, click Close to close
the geoprocessing window.
- If the model has run
successfully, the output
datasets will be added to your
ArcMap Table of Contents.

Introduction to ModelBuilder Exercise 4B page 67


Introduction to ModelBuilder Exercise 4B page 68
LET’S REVIEW!
In these two parts of exercise four, you learned how to convert an existing model to a generic one
with parameters that let a user specify input and output feature classes, set expressions, etc.

You also learned how to prepare documentation to make a generic model easier to use by
someone unfamiliar with it – in other words, you created valuable model metadata. There was a
lot of information covered here so let’s review some of the important topics.

 Creating Model Parameters: Any of the variables (input and output data, data
variables such as buffer distances, SQL expressions, etc.) used in a model can
be converted to a model parameter. Parameters are displayed as fields in the
model’s dialog window when a model is run from ArcToolbox and easily can be
replaced or modified by a user before a model is run. Creating parameters is
done by right-clicking on a variable and checking “Model Parameter” in the pop-
up window. Model parameters are displayed in the model diagram by placing the
letter P next to the variable.
 Creating Generic Parameters: Generic parameters do not have default values.
When a model’s dialog window is opened, these parameters are listed but their
values are blank. To create a generic parameter, double-click on the variable in
ModelBuilder editor and delete the variable’s value(s).
 Renaming Model Parameters: It is a good idea to rename parameters with a
short meaningful name. This name will appear above the parameter in the
model’s dialog window.
 Documenting a Model: Documentation is at first a bit confusing since it can be
created in several places and various components of the documentation can be
displayed through ArcCatalog, a model’s dialog window and a model’s help
reference page. Of the various types of help, perhaps the most useful is the help
that appears automatically when a model’s dialog window is opened. This help
includes an Abstract and Parameter help, all of which is created using the Edit
Documentation function accessed by right-clicking on a model in ArcToolbox.
Documentation also can be created in the ModelBuilder editor by right-clicking on

This concludes Exercise 4.


Save your project in your C:\ModelBuilder\Projects
folder as MyEx4.mxd

Introduction to ModelBuilder Exercise 4B page 69


Congratulations!

You have completed the exercises!

Introduction to ModelBuilder Exercise 4B page 70