31
ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

  • View
    219

  • Download
    4

Embed Size (px)

Citation preview

Page 1: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

ModelBuilder at ArcGIS 9.2

Lyna Wiggins

Rutgers University

May 2008

Page 2: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

ArcToolbox at ArcGIS 9.2

Page 3: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Creating a New Toolbox

• Create a new Toolbox in ArcCatalog or ArcToolbox. Default location for a New Toolbox created inside ArcToolbox is:– C:\Documents and Settings\<user profile>\Application

Data\ESRI\ArcToolbox\My Toolboxes.

• If you will be sharing your model and using relative addresses, you need to plan the folder location of your New Toolbox carefully.

• Create a new Model by a right click on the new Toolbox.

Page 4: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Geoprocessing Tools

• There are five ways of using geoprocessing tools in ArcGIS:– Run (some of) them in ArcMap– Run them from ArcToolbox– Type them at the command line– Use them in a script environment (like Python)– Use them in ModelBuilder

Page 5: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

What do we want to do?

• We might want to use a series of geoprocessing tools in an exploratory analysis.

• As we explore, we want to visualize our results as we work.

• We might like to change parameter values and see their impact.

• ModelBuilder is helpful in this exploratory process. Run processes as you go – you may not even want to save the model.

Page 6: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

What do we want to do?

• If you have a complex sequence of processes that you have to do frequently – or with a number of different datasets – you will want to create and save a model.

• You may want to:– run multiple scenarios – for example, for a build-out

analysis,– create custom tools and use them inside your model

or by themselves,– share your model with others.

Page 7: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

ModelBuilder

• ModelBuilder is now integrated throughout the ArcGIS product lines – any tool in Toolbox can be used to define a process. These include tools from the Extensions.

• ModelBuilder helps us create, edit, document and distribute models.

• After you create a model it can be exported as a script (to Python, for example).

Page 8: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

New Integrated Model Window

• ModelBuilder– Graphic interface– Elements

• Inputs (blue ellipses)• Outputs (green ellipses)• Processes (gold rectangles)

– Drag and drop tools (processes) from ArcToolbox

• Fill in parameter values in dialog boxes

Page 9: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Input

• Input data can be any of the ArcGIS data types:– Coverages– Shapefiles– Geodatabase feature classes– Grids– Other ESRI formats

Page 10: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Not ready to run

Input data

Page 11: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

ModelBuilder Window

• Ready to run

• Model has run

Notice shading

Page 12: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Tools in Graphics Interface

• Some of the tools on the ModelBuilder toolbar are there to help you zoom, pan, and organize your model flow chart

• Two tools are used frequently:– Arrow tool to select– Linkage tool to connect inputs, processes, outputs

Page 13: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Model in ModelBuilder

• A model in this context is a sequence of processes made up of data and tools.

• The model flow chart gives us a visual representation of our geoprocessing work flow.

• We can just drag-and-drop our input data sets from the Table of Contents in ArcMap, and drag-and-drop our tools from ArcToolbox. We can also drag-and-drop scripts (from Python, etc.)

Page 14: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Example: ModelBuilder

Page 15: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Arranging Your Model Elements

• Use the Auto Layout and Full Extent tools to help arrange your model diagram as you work.

Page 16: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Running a Model

• We can choose to:– Run a single process– Run all ready-to-run processes– Run the entire model

• Process boxes temporarily turn red as they execute.

• We receive status messages with each run.

Page 17: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Editing a Model

• Right-click on a Model in ArcToolbox and go to Edit.

• The ModelBuilder window opens and we can begin editing.

Page 18: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

What is a Parameter?

• In ModelBuilder, our tools often need required or optional values in order to run. These are parameters.

• For example, the Buffer tool needs a buffer distance in order to run.

• We can “expose a parameter” to allow user input.

• To do this we will create a parameter as a variable.

Page 19: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Creating a Parameter Variable

• The first step is to right-click on a tool in your diagram and select “Make Variable,” then “From Parameter.”

Page 20: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Creating a Model Parameter

• We now see a new model element, named “Expression.”

Page 21: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Creating a Model Parameter

• The second step is to right-click on this new model element and select “Model Parameter.” Now we see a P label in our model diagram.

Page 22: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Derived Data

• Data that is output from a process is called “derived data.” If output data from a process is not a final result, it is “intermediate data.”

• When you right-click on an intermediate output, you will see if it has “Intermediate” checked.

• Intermediate data is temporary.

Page 23: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Intermediate Data

• Models run from a dialog box or the command line delete intermediate data automatically.

• Models run from within ModelBuilder write intermediate data to disk.

• Your end results will also be flagged as Intermediate by default – you may need to change this setting.

Page 24: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Iteration

• You can use the output from a process as an input to another process.

• You can include iteration by using Lists and Series.

• You can also instruct a model to iterate until a Boolean or long variable criterion is met.

Page 25: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Model Validation

• In the Model drop down menu in the ModelBuilder window, you have the option to “Validate the Entire Model.” This checks that all of your model parameters are correct and that your input data can be found.

• Models that need repair (for example, if an input data set was moved from its initial location) will show up in the toolbox with a red X through them.

Page 26: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Documentation

• ModelBuilder includes documentation functions.

• A good idea with a complex model.

• May become as important as geospatial metadata.

Page 27: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Element Labels

• You can document each process, data element or connector with a label.

• These labels stay with their element if the element is moved. They are deleted if the element is deleted.

• Right-click on an element and select “Create Label.”

Page 28: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Documentation Editor

• You should document your models for yourself and other users.

• Start editing your model in the ModelBuilder window. Then right-click on tool and select “Edit Documentation.”

• The information you write about a tool will be integrated into the Help file.

• Back in ArcToolbox, you add additional documentation. Right-click on your model and go to Edit Documentation.

• You can access the documentation through the Help Page, the metadata tab in ArcCatalog and the model’s side dialog panel.

Page 29: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Distributing Your Model

• To distribute your model, you will need to set model Properties. These include:– Model name, description, etc. (Note that the

model name can not contain any spaces or special characters.)

– Relative paths to the toolbox location (pathnames maintained relative to the toolbox)

– Preview model parameters – Preview model environment settings

Page 30: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Distributing Your Model

• Save your model as a tool in the Toolbox.• Save your model as a .tbx file (stand

alone).• Save your model in a geodatabase.• Make sure your toolbox is read/write to

your users, and that related data, scripts, documentation, etc. are shared. And that you set relative paths, so that moving the data doesn’t break the model.

Page 31: ModelBuilder at ArcGIS 9.2 Lyna Wiggins Rutgers University May 2008

Export Your Model

• You can export your model as a graphic – – .bmp, .jpg, .emf

• You can export your model to a script.

• Both are from right-click on the Model in ArcToolbox.