You are on page 1of 62

Working with ModelBuilder

Presentation Objective
Understand and Use ArcGIS ModelBuilder
Review Geoprocessing in relation to ModelBuilder
Defining ModelBuilder
The ModelBuilder Interface
Creating Models
Creating Tools from Models
Adding Scripts to Models
Exporting & Sharing Models
Creating Documentation for Models
This PowerPoint available as a PDF at www.junipergis.com\Links
1/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9
Geoprocessing is any operation that manipulates data.
Geoprocessing can be anything from basic data management to advanced analysis.
Geoprocessing is implemented as a collection of methods.
ArcToolbox
Command Line
Scripting
ModelBuilder
ArcObjects\VBA

2/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9
ArcToolbox
A collection of tools, often the starting point for most geoprocessing.

3/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9
Command Line
Lists inputs, options, and will finish key words.
Useful for experienced users, especially those with ArcInfo Workstation
background.
Useful for new users - quickly repeat similar commands without opening
the Tool dialog.

4/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9
Scripting
Can use Python or other
scripting languages to
perform Geoprocessing
operations.
Useful for
-batch processing
-repeatable operations
-If/Then functions

5/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9
ArcObjects\VBA
Geoprocessing tools can be used
in VBA or you can use VBA to
create new tools for use in
ArcToolbox.

6/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9
ModelBuilder
Provides a graphic interface for Geoprocessing operations

7/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9
These methods provide different ways to accomplish the same task.
All methods require similar parameters.
Input Features the data to be manipulated
by the tool.

Output Feature class the results of the


tool operation Derived Data

Other options depending on the tool.


Environments where files are stored,
which coordinate system to use for output, etc.

8/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9
These methods often complement each other.
Running a Tool with the Command
line open, fills in the command line.
Models can be exported to Scripts
Scripts can be used in Models
Models and Scripts can be run
as tools from ArcToolbox,
or from Command Line.

9/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > ArcToolbox
ArcToolbox Organization
ArcToolbox contains Toolboxes, which can
contain Toolsets, which contain tools,
models & scripts.
ArcToolbox has several system Toolboxes,
with the available tools based on the license.
Users can create custom toolboxes, toolsets,
tools, models, and scripts.
Tools can be copied/pasted between
toolboxes.

10/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > ArcToolbox
ArcToolbox Tool Layers
Tools can be added to the Table of
Contents
Can include Models.
Acts like a layer, runs like a tool.
Saves last parameters; speeds
operations.
Tool Layers can be rerun with
different parameters.
Results layer will be named
Output Feature Class, but actual
data will have the name specified
in the tool.

11/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > ArcToolbox
Managing Toolboxes
Right-click inside ArcToolbox to:
Create New Toolbox
Add Existing Toolbox
Set Environments
Hide/Show Locked Tools
Save/Load Settings
Save Settings to Default
is good practice so your
new tools always display.

12/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > ArcToolbox
Storing Toolboxes
System Toolboxes are stored inArcGIS\ArcToolbox\Toolboxes
as .tbx files.
Other toolbox files can be stored here.

13/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > ArcToolbox
Storing Toolboxes
Custom toolboxes are normally
stored in the profile directory.
Use Tools>Options>
Geoprocessing to change location.
Custom Toolboxes, and any tools
or models in them, can be shared
by sharing the .tbx files.

14/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > ArcToolbox
Viewing Toolboxes
Toolboxes are buried deep in ArcCatalog or when
adding toolboxes to ArcToolbox.
Change this by selecting Options>General tab in
ArcCatalog and setting Toolboxes as a top level
entry.

15/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > Environments
Geoprocessing Environment Settings
Default workspace, coordinate system, etc.
Environment can be set in several places
Need to watch hierarchycan be set at tool
document (model) or application level.
Settings created in ArcCatalog differ from
those in ArcMap.
Untitled ArcMap document picks up the
most recent ArcCatalog setting.
Common errors with geoprocessing
methods are having invalid workspace, or
wrong coordinate system or GDB extent.

16/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > Environments
Geoprocessing Settings
Tools>Options>Geoprocessing
Overwrite Outputs
Log geoprocessing to
History
Set location of user toolbox
folder
Access Environment
Settings
Add Results to Display
Set Results as temporary
All these settings can effect how
Models work

17/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Geoprocessing Basics in ArcGIS 9 > Projections
Geoprocessing and Projecting Data
Some geoprocessing operations will create new data in the projection
specified in the Geoprocessing Environment dialog.
Does not recognize datum transformations unless set in the
Geoprocessing environment.
If input and output data have
different datums, best to
create the output in the same
projection as the input and
then project the data with
appropriate datum shift.

18/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
What is Model Builder?
Graphical interface used to build models of processes
A way to capture a workflow
Authoring environment used to create tools

19/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
What is Model Builder?
A Tool to perform:
Repetitive Tasks
Suitability Models
Process Models

20/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
What is Model Builder?
Provides a method to run several variations of the analysis.

21/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
What is Model Builder?
A means to document your work.
Provides graphical documentation of
the process.
Can generate separate reports as
an XML document.
Can be shared and used as a template for
similar analysis.
Can be exported as part of a toolbox
or as an .XML document.

22/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Created inside a custom toolbox
in ArcToolbox or a Geodatabase.
Models can be imported from
ArcView 3.x models.
Can start ModelBuilder from
the Standard Toolbar in ArcMap

Save to custom toolbox or delete when finished

23/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Models work only with the Tools
in ArcToolbox.
Tools can include other models,
scripts, and DLLs created with
ArcObjects.
Models work with all supported
data types.

24/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Everything in a model is an element
Tool elements (rectangular) or Variable elements (oval)

25/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Variables - values that can be changed in the Model
Data Variables references data on disk or map layers
Input data you add to model
Output new output or modified input data
Value Variables numbers, strings, extents, spatial references, more

26/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Output data types
New output data - Data written to disk after tool is run
In/out output data - Result of tool that alters input data
Need to know tools to understand output

27/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Data types
Different tools expect different data types for input or output
Need to know what tools work with what data types

28/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Special Tools
There are tools that are unique to ModelBuilder or very useful in
ModelBuilder.
Data Management>General>Select Data Allows access to data inside
folders, Geodatabases, or feature datasets.
Data Management>General>Merge Branch Used to merge two or more
logical processes into a single output.

29/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
More Special Tools Data Management>Layers and Table Views>
Make Feature Layer
Make Raster layer
Make Table View
Apply Symbology from Layer
Make Query Table
These are usually temporary layers used
for model inputs

30/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
More Special Tools Some tools, such as Select Layer by Attributes or Select Layer by Location
only work on layers within a map, not directly on data sources.
Use the Make Feature Layer or Make Table View to create a layer or table
view as needed for data not already in the map.

31/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Model Properties should be set when
first creating a model.
Name should not have any spaces
9.3 doesnt like underscores
Label is what shows in ArcToolbox
and on the ModelBuilder window.
Good practice to set Store relative
path names
Set Environments here if specific
to the Model.

32/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Models are built by dragging tools and data into the ModelBuilder
window, connecting
these elements into a process or workflow,
and then setting parameters or variables for the elements.

33/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Element color and shape indicate the type of element.
Element coloring and shading indicate status.
Uncolored elements are not ready to run.
If you validate a model, elements that no longer work lose color.

34/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model Derived Data
Tools dragged into the MB window will contain an output element for the
Derived Data that results from this tool.
Output file names should not have more than 13 characters. Even if you set
overwrite existing files, ModelBuilder can crash or delete files having the
same first 13 characters.

35/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model Derived Data
Derived data can be set to Intermediate and/or
Added to the Display (Table of Contents).
By default any derived data is set to
Intermediate.
The final element cannot be set to
Intermediate

36/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model Derived Data
Derived data created by running a Model from the ModelBuilder window
is saved to disk even if set to Intermediate.
Then the next time you open the model, the already run states are
honored.

37/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model Derived Data
Derived data flagged as Intermediate, created by running a model
from its dialog box or command line, is automatically deleted at the
end of the execution of the tool.
Intermediate data can be removed manually
by using the Delete Intermediate Data
command from the menu.
This helps if the Model crashes when trying to
overwrite existing data.

38/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Models can include other Models or Scripts, dragged into the model.
Models used in another model need to have parameters set.
Scripts must be added to a toolbox in ArcToolbox and then
dragged into the model window.

39/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Model flow can be controlled by setting
preconditions.
Preconditions are properties of a tool.
Often used for branching.

40/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Model elements are manipulated from the
context menu.
Opening a Tool opens the same dialog
box as in ArcToolbox.

41/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Element Context menu
Open
Model Parameter
Add to Display
Intermediate
Create Label
View Messages
Rename
Display Properties
Properties

42/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Element Properties additional functionality for data elements
General type of values and
feedback variable; used with iteration.

43/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Element Properties
Data Type used to set
data type when creating a stand-alone variable.

Feature Set data type can


be used for interactive data creation.

44/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Element Properties
Layer Symbology - can specify the layer symbology for
derived data that will be displayed in the map.
Values used for symbology must match exactly.

45/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Batch Mode for a tool input
Create a list of inputs,
variables, and outputs to a
tool by setting properties for
the input element to a
list or series of values.
List runs the connected tool
and all downstream processes
for each item in the list.
Series runs the entire model
for each item in the list.

46/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Iteration
Specify number of iterations
or until a condition is satisfied.
Best to set a maximum number
of iterations until the model is
tested to prevent an endless loop.

47/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
In-line variable substitution
Used to create a variable
for inputs that are unknown
when creating the model.

48/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Use zoom tools to navigate within a model.
Use Overview window to see entire model while zoomed into a detailed
area.

49/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Elements can be arranged manually by dragging
or arranged automatically.
Use Diagram Properties to specify Automatic or
Manual Layout and to set properties for automatic
layout.

50/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a Model
Labels can be attached to model elements.
Double-clicking a label lets you edit the label.
Right-clicking opens a
properties box.
Standalone labels can also
be placed in the model by
right-clicking any blank
area in the model window.

51/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Running a Model
Model can be run all at once or one process at a time.

Running one process at a time is a way to check


progress as you build a model.
Often necessary to run parts of models to provide inputs
for downstream steps. Or could use in-line variables.

52/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Validating and debugging a Model
Models can be Validated.
Validation wont provide
messages; elements with
errors will turn blank.
Right-clicking tools
accesses View Messages
which describes the error.
The fix is usually to reset
parameters for that tool.

53/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Validating and debugging a Model
Running a Model opens the
process dialog, and any errors
encountered are shown in red.
Scroll through the entire dialog box, as
there could be several errors.

Most common errors are that even when


Overwrite outputs of geoprocessing
operations is set, ArcGIS doesnt always overwrite files.
Potential fix is to delete intermediate data.

Another problem is when files share the 1st same 13 characters, ArcGIS
sometimes thinks there is only one file, and may inadvertently delete a file.

54/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Opening Models
Models can be opened as a graphic
window using Edit or as a tool
using Open or in Batch

55/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a tool\dialog from a Model
Adding parameters to data elements
and creating parameters of variables for
tools builds a custom dialog box for
that model.
Dialog box is often easier for someone
not familiar with the model to enter and
change parameters.

56/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating a tool from a Model
After a Tool has been created from a Model, the Model can be run in
Batch mode.

57/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Creating Reports
Reports can be viewed or saved to a file. Saving to a file
is a good way to document the model for other users.

58/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Exporting Graphics
The model can be exported to graphics
as a .Bmp, .Jpg, .PDF, or . Emf file. This
can then be added to a layout.

59/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


ModelBuilder
Exporting to a Script
The model can be exported a script. This can be
useful because scripts can be run at the system
prompt or from Python without having ArcGIS open.
This is also a good way to display the correct syntax
for tools to help create scripts.

60/62

Copyright 2006-2009 - John Schaeffer

Working with ModelBuilder


Creating Help
Custom help can be created for models.
Works like standard tool help and can include graphics.

61/62

Copyright 2008 John Schaeffer\Juniper GIS Services

Working with ModelBuilder


ModelBuilder Demonstration

62/62

Copyright 2006-2009 - John Schaeffer

You might also like