Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

Exercise 1: Basic ModelBuilder

These exercises were written by Lyna Wiggins at Rutgers University in May 2008, updated in
April 2010.

Our first model is for the classic “notification” work flow. This work flow arises when you have
to notify adjacent property owners about a potential variance, permit, regulatory action, etc. We
will be using a parcel dataset from Middlesex Boro. This is a shapefile, and the pathname is
c:\student\MiddlesexBoro\parcels.

Here is the pseudo code for our first model:

 We want the user to be able to select any parcel, using a standard SQL query.
 Next, we want the user to be able to specify the buffer distance to be used from the
selected parcel.
 The buffer should then be generated.
 We want the user to have an output map that shows just the parcels that need to be
notified.
 Finally, we want to output a table of the parcels that need to be notified. (This allows us
to use the records in the output table for mailing notices to the correct parcels.)

Step 1: Start a new model. Our first step is to create a new toolbox, start a new model. To do
this, open ArcToolbox within ArcCatalog. Navigate to where you would like to store your new
toolbox, C:\student\. Right-click and select New Toolbox. Name it Workshop Models. Then
right-click on your new toolbox, and go to New, then select Model. Name your model
Notification using Rename. Close ArcCatalog and open ArcToolbox within ArcMap. Right
click on the parent toolbox called “ArcToolbox” at the very top of the ArcToolbox window and
select “Add Toolbox…” Locate your newly created toolbox and add it to ArcToolbox within
ArcMap.

Step 2: Add an input data set. Our next step is to open up the ModelBuilder window and add
our input data set. Open the ModelBuilder window by a right-click on the Notification model,
then select Edit. Bring in the parcel shapefile into ArcMap. Drag-and-drop the parcel shapefile
into the ModelBuilder window. Rename the parcel input to Middlesex Boro parcels.

Step 3: Add a process to the model. Next, we want to add our first process – the Select tool.
You are accustomed to running this tool from ArcMap. Here we need to find it in ArcToolbox.
It is in under Analysis, then Extract. Drag-and-drop it into the ModelBuilder window. Use the
Add Connection tool to connect the input dataset (parcels) to the Select process. Then rename
the output to be Selected Parcel. Our model appears ready to run – but, remember that we want
to be able to select a specific parcel from its address. So we need to make a variable from a
parameter.

Step 4: Make a variable from a parameter. To make a variable from a parameter, right-click on
the Select process. Go to Make Variable, then From Parameter, then Expression. Double-click
on Expression and you get the usual SQL dialog box. Complete the expression to select the

ModelBuilder Exercises, May 2010 Page 1


parcel with an address of 421 Clinton Av. The field name is PropertyLo. When you have
completed your query statement, right-click on the Expression oval and select Model Parameter.
Then rename the expression to be Query a parcel address. We want to see the parcel that is
selected as layer in our Table of Contents. So right-click on the Selected parcel output and select
Add to Display.

Step 5: Run the model for the first task. Use the Auto Layout and Full Extent tools to organize
your flow chart. The first task of our notification work flow is ready to run. Click on the Run
tool. The icon looks like this . Check to see that the model executed correctly by checking
your Table of Contents for the selected parcel. At this point, my model looks like this:

Step 6: Add the Buffer process. Now we want to buffer the selected parcel polygon. Drag-and-
drop the buffer tool from ArcToolbox. It is in Analysis, then Proximity. Review the steps,
above, to create a variable for a parameter so that the user can input the buffer distance. Enter a
buffer distance of 500 feet. Rename the parameter to Buffer distance input. Rename the output
to be Notification buffer. Don’t forget to add this intermediate data product to your ArcMap
Table of Contents by a right-click and selecting Add to Display. Run your model and check your
output. At this point, my model looks like this:

ModelBuilder Exercises, May 2010 Page 2


Step 7: Add the Clip process. Since our work flow indicated that we wanted to be able to map
the buffers that need notification, we want to add a clip function. Remember the dialog window
for the Clip tool. You need to first specify the input features. Your input features are the
parcels. Use the Add Connection tool to connect Middlesex Boro parcels to the Clip process.
You next need to specify the clip features. This is the Buffer for the selected parcel. Use the
Add Connection tool to connect Buffer to the Clip process. Rename the output to be Parcels to
Notify. Make sure to Add to Display. Run your model and check your output to make sure it
ran correctly. At this point, my model looks like this:

ModelBuilder Exercises, May 2010 Page 3


Step 8: Create a table for a mailing list. Our final step is to create a table that we can use to
mail out the notifications. In the Data Management Toolbox, under Tables, you will find a
Copy Row tool. This tool works well here. Drag-and-drop it into your model. Rename the
output to be Notification table. Because .dbf files are particular about their file names, it is smart
to change its output file name. Double click on Notification Table. Rename the output file to be
Notices.dbf. And turn the check for Intermediate to off. For the output, select Add to Display so
that we can check our results. Close your ModelBuilder window – and don’t forget to Save your
model! Then close ArcMap, saving your .mxd file. Here is my final model:

ModelBuilder Exercises, May 2010 Page 4


Assignment 1.1: We have been renaming the components of our model. This gives more
clarity to the model flow diagram. But what are the file names and paths to our intermediate and
final outputs? List them here.

Step 9: Rerunning the model. Rerun your model, changing the address to select to 1 Elmwood
Av and your buffer distance to 200 feet. You will also need to change the file names of your
inputs/outputs to the processes. Remember that ArcMap gets unhappy when you write to files
with the same names. I always just add an incremental number to the end of my file names to
help myself keep things straight. We’ll talk more about this file naming issue in a later exercise.

ModelBuilder Exercises, May 2010 Page 5


Exercise 2: Iteration Using Lists and Series

Our second model helps us with the problem of wanting to clip many features classes for a study
area. In this case we will have 3 features classes that we wish to clip. These 3 features classes
are the roads, streams and wetlands for Hunterdon County. We have 3 study areas that we wish
to use for clipping. These are called StudyArea1 and StudyArea2. These datasets are in a
geodatabase. The pathname is c:\student\Hunterdon\Hunterdon.gdb.

Here is the pseudo code for this model:

 Bring in all of the feature classes that need to be clipped.


 Bring in all of the study area feature classes that will be used for clipping.
 Clip all of the feature classes by the first study area and create new feature classes, each
named something easy to understand.
 Create an iterative model so that the features classes are then clipped by the second
study area, third study area, etc., until the study area feature classes are each used.
Create new output feature classes of the clipped feature classes, each named something
easy to understand.

Step 1: Explore the data. Bring in all 5 datasets into ArcMap and do a bit of exploration to
start.

Step 2: Create a variable, and declare it to be a list. We could do a simple model like the one
following. But this is not an elegant solution! And it would be painful if there were 20 (or
more!) feature classes to be clipped.

ModelBuilder Exercises, May 2010 Page 6


Instead, we will create an iteration using lists. Create a new model in your own Toolbox and
name it ClipStudyAreas. Open up the ModelBuilder window for Editing. Right-click and select
Create Variable. Examine your choices here – there are a lot. Then select Feature Class. Right-
click on your new Feature Class and go to Properties. Here you want to click on the radio button
for “A List of Values.” While you are there, note that on the Data Type tab, it correctly specifies
Feature Class. Note that there is also a Layer Symbology tab. Here you could import a layer file
to create a desired symbology. Click OK. Note that you now have several ovals stacked on top
of each other. This indicates a List of Values will be input into our model.

Rename your Feature Class inputs to be InputFeatureClasses.

Step 3: The Batch Grid. But something is different here! Double clip on the
InputFeatureClasses oval. Instead of the usual parameter control dialog we are used to, we get a
Batch Grid. The user interface to this Batch Grid behaves somewhat strangely. Rather than me
trying to write about it, experiment on your own until you figure out how it works. Here is my
batch grid after I have specified the paths to the 3 input feature classes:

Step 4: Create a Series variable. A Series is similar to a List in that it contains multiple values.
Where the Series is different, is that that the entire model will be run once for each value in the
Series. So we want our feature classes for multiple study areas to be a Series. Then the Clip
process will run on each of the input feature classes, once for each study area. At this point, stop

ModelBuilder Exercises, May 2010 Page 7


a minute, and think carefully about what this means for the names of the output feature classes.
We need to define these carefully so that we don’t use the same output file names! We will use a
syntax convention to take care of this issue. We will complete this in a later step.

Right-click somewhere in your ModelBuilder window. Select Create Variable. Again select
Feature Class as the variable data type. Rename your new variable StudyAreaInputs. Then
right-click and go to its Properties. Here, you want to use the radio button to select “A series of
values.” Click OK. Then double-click on StudyAreaInputs, and fill out the Batch Grid correctly,
using the two study area feature classes.

Step 5: Adding the Clip process. Remember that the clip process first wants a parameter for the
input features. Then it wants a parameter for the clip features. Add the Clip process to your
model. Add a connection first from InputFeatureClasses. Then add the connection from
StudyAreaInputs.

Step 6: The output file names. Finally, we need to deal with those output file names. Double-
click on the output oval. We will have to type in changes to the output file names ourselves.
ModelBuilder will not do this for us. For the first output, you should see the pathname:

C:\student\Hunterdon\Hunterdon.gdb\roads_Clip.

Change this to:

C:\student\Hunterdon\Hunterdon.gdb\roads_Clip_%i%_%n%

The %n% syntax will have values of 0 and 1. The 0 corresponds to the first Series input. In our
case this is StudyArea1. The 1 corresponds to the second Series input. In our case this is
StudyArea2. This syntax will work for any n Series inputs. So you could create a model for 20
(or any n) study areas this way.

The %i% syntax will have values of 0, 1 and 2. This corresponds to the Iteration on the input
feature classes – roads, streams and wetlands. Roads will have value 0, streams will have value
1 and wetlands will have value 2.

Complete the required file name changes in the output Batch Grid.

Then remember to select Add to Display so that the output feature classes will show up in
ArcMap for you to check.

Step 7: Set the model’s iteration value. We have 1 more step to complete before we run the
model. In ArcToolbox, right-click on the ClipStudyArea model, and go to Properties. Open the
Iteration tab. Here you will find a radio button that allows you to select “Run the model the
following number of times.” Here we want to override that value by selecting “Get the iteration
count from this variable.” You want to select StudyAreaInputs as the variable. Now you can run
your model. My model looks like this:

ModelBuilder Exercises, May 2010 Page 8


Assignment 2.1. What are the names of your output feature classes?

ModelBuilder Exercises, May 2010 Page 9


Exercise 3: Iteration Using a Boolean Condition

This model helps us answer a question about population distribution. Starting with a census tract
layer for New Jersey, if we pick any 1 tract, how many contiguous (touching) tracts does it take
before the population exceeds 50,000 people. This might be useful for planning transit oriented
development or open space acquisition plans. For this model, we will have the model iterate until
a Boolean condition is False.

Here is the pseudo code for this model:

 We need to bring in a dataset for the census tracts in New Jersey, with a population
count field.
 Then we want the user to be able to select a particular tract.
 Then we will want to find out how many contiguous tracts we have to add to the selected
tract until the population count exceeds 50,000.
 We would then like to map our result.

Step 1: Explore the data. Bring in the dataset for Census 2000 for New Jersey tracts. The
pathname is c:\student\CensusTracts\centrt2000.shp. The population count field is named
Pop2000. Try several thematic maps looking at both population counts and population density
(per square mile). Check out the tracts that are largest and smallest by population count.

Step 2: Select a tract to start. Create a new model in your own Toolbox, and name it
CensusCounts. Drag the Census Tracts layer into your Model. We will select one tract from the
layer using Select By Attributes. You can use the KEY field to uniquely identify one tract for the
analysis. (i.e. The tract containing DEP is "KEY" = '34021000900') As an alternative, you can
also select one census tract using the Interactive Selection tools in ArcMap.

Step 3: Select by location. Now we need to select by location. You know how to do that in
ArcMap, but where it the tool in Toolbox? It is under Data Management, then Select Layer by
Location.* Make sure you fill out the parameters correctly for the Select By Location tool! I’ll
let you figure this out for yourself. (But be sure to make the correct decision for Selection
Type!)

*Note: If you added the Census Tracts through Add Data in the ModelBuilder window,
ArcGIS will treat the Tracts as a Feature Class, instead of a Layer. For the purposes of
ModelBuilder, consider Feature Classes as GIS objects that would be processed using
ArcCatalog and Layers as GIS objects used in ArcMap. The Make Feature Layer tool
bestows the additional ArcMap functionality on to your ModelBuilder feature classes.
This will become an issue, as some tools only accept Layers as input, such as Select
Layer by Location.

Step 4: Determining the Total Population Count for the selected polygons. Again, you know
where the Summary Statistics tool is in ArcMap, but where is it in Toolbox? This time, find it
yourself using the Search panel in ArcToolbox. The Summary Statistics process will output a
table with a single record (row). You want the output field to be the total population count. It is

ModelBuilder Exercises, May 2010 Page 10


automatically named SUM_POP200. (Notice the automatic shortening of the field name for
the .dbf file format.) Since this is a .dbf file, make sure that your output file name is short!

Step 5: Checking to see if the total population exceeds 50000 yet. The Make Table View tool
(look in the Data Management Toolbox to find it) allows you to create an expression that selects
all records that meet a specific criteria. Add this process to your model. Fill out the parameters
correctly.

Step 6: Using a Boolean condition to stop iteration. Using the Get Count process provides one
way of setting a Boolean condition. Get Count returns the number of selected rows from an
input table. The output is of data type LONG, not a binary 0,1. But it will work since the
Boolean condition accepts any number greater than 0 as True.
Add this process to your model and set your parameters correctly.

Step 7: Set the Model’s Iteration. Back in ArcToolbox, set the iteration properties of your
model. See if you can figure this out yourself. (Hint: You might want to set the maximum
number of iterations as well.)

Step 8: Viewing the Results. After running the tool, it may not appear that anything has
happened. If this is the case, refresh the map view by changing the zoom or extent, or by clicking
the refresh button in the lower left corner of the map frame. You can now open the census tract
layer's attribute table to see the newly selected adjacent tracts.

ModelBuilder Exercises, May 2010 Page 11


Exercise 4: Suitability Analysis

This exercise is designed as an exercise for a realistic (but not too complex) suitability analysis.
I suggest that you read through the entire exercise before proceeding.

The scenario is: You are tasked to develop the land use component of a Master Plan for
Delaware Township, New Jersey. In this exercise you will complete the suitability analysis for
new residential land use. Delaware Township is in a more rural area of Hunterdon County.
Several years ago it was named in New Jersey magazine as “the best place to live in New
Jersey,” and it is facing growth pressures.

The Township has provided you with the following Goals and Objectives. These were
developed through a public process in the Township (of course, this is fictional – I actually wrote
these!). Among others Goals, here are the Goals and Objectives that directly impact your
suitability analysis:

Goal 1: Protect the agricultural land in the Township. (This goal was ranked highest by the
citizen group.)
Objective 1: Protect existing agricultural land through zoning and the use of public acquisition
and Farmland Preservation programs.
Objective 2: Discourage the expansion of rural residential areas into adjacent farmland.
Goal 2: Protect the environmental quality of the Township. (This goal was ranked second
highest by the citizen group.)
Objective 1: Preserve all of the Natural Heritage Priority sites in the Township.
Objective 2: Preserve the wetlands areas in the Township.
Objective 3: Preserve steep slopes (greater than 10 percent).
Goal 3: Encourage high- and medium-density housing for new residential growth. (This goal
was ranked third highest by the citizen group.)
Objective 1: New residential development should be of high- or medium-density and should be
adjacent to existing high- and medium-density housing areas.
Objective 2: New residential development should not be close to industrial areas, airports or
Known Contaminated Sites.

Step 1: Draft Model. Get out your pencil and paper and sketch out a Draft Model. Your model
should have a box for each SUA. (Hint: There should be 7 SUAs.) The 7 SUAs need to be
weighted and summed to form 3 MUAs. (Hint: These are the 3 Goals.) Although you could
return to the citizen group to develop the scales for the SUAs and also the weights, you realize
that you don’t have time to do this. So, you will use your expert judgment to develop utility
values (from 1 to 9) for each SUA. The scales should be from 1 (extremely unfavorable for
residential development) to 9 (extremely favorable for residential development). You will also
use your expert judgment to develop the weights for combining the SUAs into the 3 MUAs.
However, you will use the ranking of the 3 Goals by the citizen group to complete your final
weighting and summing. (Hint: Check out the reading and powerpoint slides for the formula for
translating rankings into weights.) Remember how easy it is to confuse file names as you create
all of the output grids, so organize yourself right away with some naming conventions on your
Draft Model Flow Chart.

ModelBuilder Exercises, May 2010 Page 12


Step 2: Data Acquisition. Your first step is to acquire and organize the datasets for your
suitability analysis. Organize a file folder for your datasets where you have write access and a
lot of space. We will use existing datasets from the New Jersey Department of Environmental
Protection. Go to the NJDEP GIS site (http://www.nj.gov/dep/gis/). Download the following
datasets:
Land use and land cover datasets for 2002 for Watershed Management Areas 8 and 11.
10-meter DEM datasets for Watershed Management Areas 8 and 11
Known Contaminated Sites (statewide)
Natural Heritage Priority Sites (statewide)
Municipal boundaries (statewide)

Step 2: Data Pre-Processing. You need to pre-process some of your vector datasets prior to
rasterization. Complete the following tasks:
a) Create a vector layer that is a single polygon for the Delaware Township
boundaries.
b) Create a vector layer that is a single polygon for Delaware Township plus a 1-
mile buffer around the Township boundary. This will be your analysis area.
(Note: It is good practice to buffer around your actual study area when using
raster analysis to minimize the “edge effects” of some of your analysis functions.
c) Merge the 2 datasets for Land Use and Land Cover (LULC) for the 2 watersheds.
(Note: You need these to be in 1 layer before rasterization.) Then clip the
merged datasets by your analysis area polygon.
d) Mosaic the 2 datasets for elevation. (Hint: Use the Raster Calculator and the
following expression: MOSAIC (grid1, grid2).)
e) Clip the Known Contaminated Site dataset and the Natural Heritage Priority Sites
dataset by your analysis area polygon.
f) Before proceeding, reread the Goal and Objective statements, above. Revise your
Draft Model, as needed. Then create several vector layers from the LULC.
Following are 2 examples. You will need to figure out others on your own.
a. For the suitability analysis, you will assume that new development can not
take place in existing URBAN (land use category 1 at the first level). (Yes, I
know that redevelopment is possible, but we are keeping it simple here.) So
use Select by Attribute and then Data, Export Data to create a vector layer for
the urban polygons. (Hint: Later, when you rasterize this layer, remember
how useful a value of NoData can be in later analyses.)
b. You will need a vector layer for existing high- and medium-density residential
for Goal 3, Objective 1. (Hint: You will need to use the land use categories at
the third level for this query.) Use Select by Attribute and then Data, Export
Data to create a vector layer for these polygons.
g) Complete the other vector layers that you need to pre-process for the other
Objectives. As you do this, jot down notes about your decisions and processing
steps for later documentation.

Step 4: Rasterization and Raster Analysis. Reread all of the Goals and Objectives one more
time and again revise your Draft Model, if necessary. At this point your “Draft” should become

ModelBuilder Exercises, May 2010 Page 13


a “Final.” Complete the rasterization of all of the vector layers you have created. (Hint: Don’t
forget, as the first step, to use the Options from the Spatial Analyst toolbar. Set your extents to
your analysis area and the cell size to 50 feet. Make sure that the pathname to your workspace is
correct. Don’t forget to save a map file (.mxd file) with these settings and your layers if you are
not completing this exercise in one work session.)

Then complete the raster analysis steps. Following are 2 examples. You will need to figure out
others on your own. (Note: Also continue creating notes on the decisions you make for each
computation so that you can document your Model.)
a) Use the Map Algebra calculator to create a grid for all slopes greater than 10
percent. (How will you assign utility values to this grid? You might choose to
Reclass the slopes greater than 10 percent to a value of 1. All other cells would
have a value of 9 for this factor. This is a decision to create a binary (two-value)
layer. Other decisions are possible.)
b) Create a Distance grid (straight line) to the existing high- and medium-density
residential cells. (How will you assign utility values to this grid? How will you
decide on the “maximum distance” to use? You might choose to use an Equal
Interval classification, then Reclass the values to 1 through 9. Or you may have
reasons to use another classification. Whatever you choose here, write down the
documentation for your decision.)

Step 5: Weighted Overlay. You are now ready to complete your weighted overlay. Document
your expert rationale for the weights you use to combine your SUAs into the 3 MUAs. Then
complete the complex MUA from the 3 MUAs, using the citizen group’s rankings for the
weights. Prepare a good looking map for your final results. Assume that this map will be
displayed at a public meeting. This map should use the Delaware Township boundaries, not the
study area boundaries. It should have the basic required elements - title, legend, scale and north
arrow. Also include a note about what the values mean in the final map. (Or you could add
words to your legend that make it clear.)

Step 6: Model Builder. You realize that you may be called upon to run different scenarios with
different weights. You decide to construct a simplified version of your Model using Model
Builder. Although you are aware that you could go all the way back to your vector layers and
start the Model Builder Flow Diagram there, we will not do that for this exercise. Instead, start
with your 7 SUAs (the 7 raster layers, after all processing steps). These 7 raster layers will be
your input data layers. Your Model Builder will show only how the weighted overlay was
performed. Here are the steps to begin your work with Model Builder:
a) In ArcCatalog, go to your working folder (where you have been organizing your
data). Right-click on the folder and create a New Toolbox. Rename it something
appropriate.
b) Back in ArcToolbox, right-click at the top level of ArcToolbox and select Add
Toolbox. Give the pathname to your new Toolbox.
c) Right-click on your new Toolbox and select New, then Model. You are ready to
start with Model Builder.
d) It is easiest to construct your Model by dragging and dropping. Drag and drop the
raster layers into your Model. Then drag and drop the tools you need from

ModelBuilder Exercises, May 2010 Page 14


ArcToolbox. Create the appropriate connections. Use Model, then Run to
execute your model.

Assignment:
Please turn in the following results, in a Word document:
a) Your final suitability map, from Step 5. Along with your map, please write a
short description that describes the spatial pattern of the most suitable areas for
new residential development. In your description, also provide the total acreage
of the most suitable areas. You might also suggest whether there is sufficient
suitable area to support future growth, and whether some of the Objectives are in
conflict with each other.
b) Document each of your SUAs. Include a brief description of the data source, the
pre-processing steps, and the raster analysis steps. Then document how you
assigned utility values for your 1 to 9 scales.
c) Document the “expert” assignment of weights. Document the calculation of the
weights for the final complex MUA.
d) Include your final Flow Diagram from Model Builder. If your input raster layers
do not have clear names (for someone other than yourself), please define the
names in your documentation.

ModelBuilder Exercises, May 2010 Page 15

You might also like