Lab exercise 8 due Mar31, 2008
EES6513: Advanced GIS, UTSA
Student name: ______________
Part I: Get Start with Geoprocessing
Based on tutorials found in ESRI Visual
Campus (campus.esri.com),
"Geoprocessing with ArcGIS Desktop”
Lab data: Copy the directory of Lab 8 (Start, Prepare) under \\129.115.25.240\XIE_misc\EES6513\
into your local computer
Objective:
·
Use
ArcToolbox™ to manage geoprocessing
tools
·
Find
the appropriate geoprocessing tool for a task
·
Run
a geoprocessing operation using
Step 1: Explore ArcToolbox
Start ArcMap and open ArcToolbox
If necessary, click the Show/Hide ArcToolbox
Window button
to
display ArcToolbox.
In ArcToolbox, you should see a group of
toolboxes, like those shown below. If you are using ArcInfo
and have ArcInfo Workstation installed, you will also
see the Coverage Tools toolbox.

These toolboxes contain the tools that you will use
to carry out all of your geoprocessing operations.
You will be working with them (most of them in the analysis tools) throughout
the rest of the course.
You have
been familiar with part of these geoprocessing tools
in the previous lab from the tool's dialog box. Now you need to learn how to
manage your toolbox.
Step 2: set geoprocessing options
Start ArcCatalog.
From the Tools menu, choose Options, click the Geoprocessing tab. The options
that you set on this tab apply to all subsequent geoprocessing
operations in ArcMap and ArcCatalog.
Check Overwrite the outputs of geoprocessing
operations and Log geoprocessing operations to a history model.
Click the General tab. For
top-level Catalog entries, scroll down the list and check Toolboxes, so that
the system toolboxes will be displayed in the Catalog
Tree. Uncheck the box for Hide file extensions, found at the bottom of the
dialog box. Click OK to close the Options dialog box.
Right-click
an empty area inside ArcToolbox. Point to Save Settings and choose To File,
navigate to your …\Lab8 folder and name the file standard.xml.
Click Save.
You
have now saved the current state of ArcToolbox, as
well as the current geoprocessing environment
settings and any variables that may have been created
in the command line as an XML
file.
As
you modify ArcToolbox in the coming steps, you do not
need to worry about making irreversible changes. When you have completed the
module exercises, to return to the standard configuration, simply right-click,
point to Load Settings, click From File, and navigate to the standard.XML file you just created.
Step 3: Match ArcToolbox
settings in ArcCatalog and ArcMap
Within an ArcGIS Desktop session, any changes you make to ArcToolbox in ArcCatalog will not
automatically display in ArcMap. To match the ArcToolbox settings in ArcMap or
other ArcGIS Desktop applications with those in ArcCatalog, you have three choices:
In the previous step, you
saved the ArcToolbox settings to a file. Now you will
load those settings into ArcMap.
Right-click an empty area
inside ArcToolbox, point to Load Settings, and choose
From File. In the Load Settings dialog box, navigate to your module folder, and
select Standard.xml.
Step 4: Create
your own toolbox
Right-click an empty area
of ArcToolbox and choose New Toolbox. Change the name
of the new toolbox to Lynx_Tools.
After you create your own
toolbox, you can copy your favorite tools into it for your particular project.
Expand the Analysis Tools
toolbox-> Extract, right click Clip
and choose Copy. Then right-click the Lynx_Tools
toolbox and choose Paste. You will add more tools into your own toolbox later.
In the Catalog Tree,
expand the Lynx_Tools Toolboxes folder, your can see
your clip tool you create, and add more tools in it. You also can remove any tools you create.
Step 5: run a tool from the
command line
On ArcCatalog,
Click the Show/Hide Command Line Window button
to
display the Command Line window.
The top part of the
Command Line window is the command line. The bottom part is the message area,
where messages display when you run a tool.
Like the ArcToolbox window, the Command Line window can be docked
(right) or be a free-standing window (left). You might
prefer docking the window to the bottom of the ArcCatalog
window. You can also resize the command and message areas.

In the command line (Only tools that are in ArcToolbox
can be run from the command line.), start typing the word buffer.
A list of possible
commands displays and there are three or two Buffer tools, select Buffer_analysis. This is the one you want
for this exercise.
Make sure Buffer is highlighted and then press the space bar on your keyboard
to insert the Buffer tool in the command line.
After the tool is inserted, usage displays above the command line,
which contains command line syntax
for the tool. In this case, you are commanding the software to buffer some
features that you specify, thus creating a new feature class that you specify,
by using a buffer distance that you specify.
Essentially, these are the
same parameters that you saw when you ran the Buffer tool using a dialog box.
Note: Required parameters appear between the <>
symbols, and optional parameters appear between the {} symbols.
Set parameters:
You want to buffer
features in the Springs feature class, so you will
choose Springs as your first parameter value. You could type the path and
filename in the command line, or you could drag and drop the feature class. You
will do the latter.
In the Catalog Tree,
navigate to your …\Start folder and expand the CentralFlorida
geodatabase. Drag the Springs
feature class and drop it in the command line.
The next required
parameter, out_feature_class, is
highlighted in the usage.
From the Catalog Tree,
drag CentralFlorida.mdb and drop it in the command line. Now press the
Backspace or left arrow key on your keyboard. Type \Zones500 (don't forget the backslash!) and press the space bar.
The last required
parameter, buffer_distance_or_field, is highlighted in usage. Type 500 and press the Space
bar.
Tip: By default, the distance units are
taken from the spatial reference—in this case, meters. If you wanted to
use different units, you would simply add them to the distance value and
enclose both in single quotes (e.g., '500 miles').
Now you will set your
optional parameters:
Since you are not creating
line features, you will accept the default value for line side. To indicate
this, simply enter a pound sign (#) and a space.
You will also accept the
default value for line end type. Enter another pound sign and another space.
For the dissolve option
parameter, double-click ALL from the drop-down list to add it to the command
line.
All of the necessary
parameters have been set, so the tool is ready to run.
Tip: An explanation of
command line syntax is available in the help document for each tool, accessible
by right-clicking the tool in ArcToolbox
and choosing Help.
Run the Buffer tool
With your cursor still in
the command line, press the Enter key on your keyboard to run the tool.
As the tool runs,
processing messages are displayed in the bottom part
of the Command Line window. These messages include information such as when the
tool began executing, which parameter values are being used,
and the progress of the tool's execution. Warnings of potential problems or
errors can also be displayed here. You may need to
resize the window or scroll up in the message area to see all of the messages.
If
you like, navigate to the new Zones500 feature class in the Catalog Tree
and preview its contents in the display window, or add it to the arcmap.
Run the tool again
Once you have run a tool
in the command line, you can quickly run that tool again, modifying any
parameter values as necessary.
In the message area of the
Command Line window, the tool you just ran and its parameters are displayed in blue text.
Right-click anywhere in
the blue text and choose Recall. The tool and its parameters are
added to the command line.
Before you run the tool
again, you will change the buffer distance and output feature
class name.
In the command line,
replace Zones500 with Zones650. Then change the buffer distance from 500
to 650.
Press Enter to run the
tool. Once the process has finished, notice that the Zones650 feature class has been added to the Catalog Tree.
Tip: Until you close ArcCatalog,
any tool that you run and its parameter values will be listed
in the command line message area, and can be recalled to the command line.
After the application is closed, the processes are logged
to a history model in the History toolbox.
Step 6 Run tools in a model
In this step, you will use
a model that allows you to run several tools in sequence. The model has been created for you. You will learn how to create your
own models in part 3.
In the Catalog Tree,
navigate to your …\Start folder and expand the CentralFlorida
geodatabase. Preview the Conservation feature
class. Of all the features in this feature class, only some represent land or
wetlands within an aquatic preserve. Suppose that you would like to create two
new feature classes; one that is composed of only
those wetland features and another that represents a 500-meter buffer of them.
In the Catalog Tree, expand
the ProjectTools toolbox.
The toolbox contains two
system tools, a script tool (Clip All), which you will use in the next step,
and a model named SelectAndBuffer. Like any other
tool, a model must reside in a toolbox.
In order to accomplish
your task, you could first run the Select tool to extract the wetland features
from the Conservation feature class and then run the Buffer tool on the new
feature class.
Or,
you can run the SelectAndBuffer model, which strings
these two processes together.
Examine the model
Before you run the model, take a look at it in ModelBuilder.
In the Catalog Tree,
right-click SelectAndBuffer model and choose Edit.
You will use ModelBuilder to compose and edit models. This model
contains two tools, Select and Buffer, that are
represented as rectangles.
The model also contains
three data elements that are represented as ovals,
which are inputs and outputs for the tools.
The tools work the same in
the model as they do when you run them using dialog boxes. The only difference
is that in the model they have been connected together
so that the output of the Select tool is the input to the Buffer tool.
In the ModelBuilder
window, double-click the Select tool to open its dialog box. Notice that the appropriate parameters for the
tool have been filled in. Features in the Conservation
feature class will be selected and the output will be
a new feature class named Wetlands. A query expression has
also been built that tells the Select tool to only select features where
the values in field NAME_A equal LAND OR WETLAND INSIDE AQUATIC PRESERVE.
Click Cancel to close the
dialog box.
The parameters have also
been set for the Buffer tool. Double-click the Buffer tool to open its dialog
box and review the parameters.
Notice that Wetland, which
was the output feature class of the Select tool operation, is
used for the Input Features of the Buffer tool. The output will be a new
feature class named Wetlands_Buffer. Notice also that
the buffer distance has been set, as has the optional dissolve type. Click
Cancel to close the dialog box.
Run the model
When you run a model, the
tool being executed is shown in red. A progress window
will also appear. It tracks the progress of the geoprocessing
operations.
Tip: Whenever you have the Command Line window open, you
will see that the same information displays in the bottom part of that window. On the ModelBuilder
toolbar, click the Run button
. When
the model finishes running, close the progress window if necessary.
Hint: Even if you selected the option to
automatically close the progress window when you ran a tool from a
dialog box, you may have to select the option again for the model progress
window.
Notice
that the tools and the output data elements now have drop shadows. The drop
shadows indicate that the model has been run.
Leave ModelBuilder
open.
In
the Catalog Tree, navigate to CentralFlorida.mdb and preview the two new
feature classes, Wetlands and Wetlands_Buffer.
Delete intermediate
data
Once you build and run a
model, chances are that you are going to run it more than once. For example, in
this case, you might want to create a different selected set or change the
buffer distance, or both. Before you run a model again, you will need to do a
little data cleanup.
In the ModelBuilder
window, from the Model menu, choose Delete Intermediate Data.
The SelectAndBuffer
model is now in a ready to run state once more. Notice that the drop shadows
have disappeared.
Look at the Catalog tree
and notice that the two feature classes, Wetlands and Wetlands_Buffer,
have also disappeared.
If you had wanted to keep
those feature classes but run the model with different parameters, you would
have to change the name of the output feature classes for the Select and Buffer
tools.
Step 7: Run
a custom script tool
In this step, you will use
a script to clip all of the feature classes in the CentralFlorida
geodatabase to the
You will learn more about
scripts later in part4. For now, you will just see what a script looks like and
how to run a script tool.
Examine the script
In the ProjectTools
toolbox. The Clip All script
tool is based on a Python script named ClipAll.py, which is located in your GeoprocessingArcGISDesktop\Start
folder. To run a script as if it's a geoprocessing tool, using ArcCatalog
or ArcMap for example, the script must be added to a
toolbox. The script (ClipAll.py) has
already been added to a toolbox and is named Clip All. You will learn
how to add a script to a toolbox later. The Clip All script tool can be run like any other geoprocessing
tool.
In the Catalog Tree,
right-click the Clip All tool and choose Edit.
Because the script was written in Python, the ClipAll.py
script opens in the PythonWin application.
You can get an idea of
what the script does by reading the comments written in the script (shown in
green text). You'll learn more about how to read
scripts in part3. When you have finished looking at the script, close Python.
Run the script tool
In the Catalog Tree,
double-click the Clip All script tool to open its dialog box. In this case, the
parameters for the Clip All script tool have not been filled
in, yet.
For the Input Workspace, drag CentralFlorida.mdb
from the Catalog Tree and drop it into the text box.
For Clip Feature Class, drag the Boundary feature class and drop
it into the text box.
For Output Workspace, drag MarionCounty.mdb and drop it into the
text box.
Click OK to run the script
tool.
Notice that as the tool
runs, the processing messages appear in the message area of the Command Line
window as well as the progress window.
When the processing is
complete, right-click MarionCounty.gdb and choose Refresh. Then expand the geodatabase
to see the clipped files.
Now you have initial impression on the basic tools of geoprocessings: Dialog tools, command line, model, and
script. You will continue to learn about Model building and Scripts writing in
the next lab