05 Ras3.AnalysisProperties
05 Ras3.AnalysisProperties
05 Ras3.AnalysisProperties
If you’re starting ArcMap up again, remember to add the Spatial Analyst Extension.
Spatial analysis is pretty easy with grid-based GIS, but we must clearly understand the
issues that relate to using this kind of data. Resolution and cell size, registration, and a
variety of analysis properties must be considered carefully or we can end up with poorly-
formed results. We’ll start by seeing what is involved in creating rasters, and how we can
use the Raster Calculator to do this. The Raster Calculator will be somewhat familiar to
those who have used map algebra-based systems like Map Analysis Package or GRID.
Environment Settings
When you use Spatial Analyst or other tools to create rasters, typically from other
datasets, environment settings are used. These settings remain in the background and are
applied when you perform an operation that creates an output. They include: (1) the
working directory; (2) the extent – a rectangular study area; (3) the cell size – the width
of the square cells; and (4) a mask – a definition of an irregular study area within the
extent, with nodata (null) cells representing areas outside the study area.
¾ Bring up the Analysis Properties window from the Spatial Analyst toolbar with
Spatial Analyst>Options…
¾ In the General tab, enter the working
directory that corresponds to where
you’re working: e.g.
“D:\workspace\raster\HMBarea” if
you’re working on the local hard drive.
5-1
Creating a grid from a feature layer
We’ll use a feature-to-raster conversion to look at the effects of
cell and extent settings.
5-2
? Can you foresee any problems in using these datasets
together?
¾ Create some new rasters from the streams and roads arc
coverages, but use an existing raster you want to match as
a reference. Start by inserting a new dataframe and adding
the elev raster and the two arc coverages roads and
streams as feature layers. Convert each vector
feature to rasters (with Spatial
Analyst>Convert>Features to Raster) using road-
code and st-code fields, but first specify “Same As
Elev” for both the Output Raster Extent and
Output Raster Cell Size in the Analysis Options.
Give them the names Roads60 and Streams60.
¾ Note the effect of the two raster resolutions on the nature of the
stream representation by alternately turning on and off these two
rasters.
5-3
Joining Data
¾ As you can probably see, the result of this is we can see two types of streams.
However, the differences between these are only important for drawing political
boundaries that also happen to coincide with the streams. Later on, we’ll simplify
this grid, since we really don’t care about these differences for grid analyses.
¾ Do the same for the other streams grid streams60 roads; and then the two roads grids,
joining the info table roads.exp.
? What are the road codes, and what are their text descriptions?
5-4
Making a mask raster
A mask raster is used to limit analysis to a specific area – no areas outside the mask are
used. Say you’d like to analyze land-use patterns on granitic rocks. There are various
ways to do this, but one way is to create a raster of granitic rock areas, then use it as a
mask raster in a query.
¾ Open the attribute table for the landuse raster, and select the record for “Evergreen
Forest”, then close the table. Create a raster with the following expression in Raster
Calculator: [landuse]
¾ Rename the result “Evergreen on Granitics”
¾ Set the Analysis Mask to “<None>” and do this same map query, renaming the result
“Evergreen Forest”. Examine the result, and note the effect.
? What is the effect of the mask?
¾ Try some other analyses, with and without masks. In a later exercise, we'll learn
other methods of selecting values and creating masks. Before continuing, clear all of
5-5
the selections in the attribute tables (find the Clear Selection operation in the Options
button on the attribute table display), and save your map document as ras3.mxd.
Setup
To create these rasters and work with them we need to (1) create a workspace folder to
work in; (2) write the script; and (3) run the script. Since the rasters we’re creating don’t
relate to any existing datasets we have – it’s like we’re creating a simulated study area –
we shouldn’t use any existing workspaces.
5-6
$$ROWMAP is a grid of row numbers and $$COLMAP is a grid of column numbers,
for a raster created using the current analysis properties. These values create rasters
that help to visualize the cell sizes.
¾ If you typed the script, save it in your raster
workspace folder as makegrids.aml, using the
“All files” file type option.
¾ Run this script from the Arc window, first setting the workspace. Quit when it's
done. The following three commands does this: (1) sets the current workspace (w) to
your raster folder (similar to opening a folder in Windows); (2) runs the AML script;
then (3) quits the arc command window. Type what’s in bold, not “Arc:” – that is the
prompt you should see in the black Arc command-line window – it means that you
are sending commands to the Arc
command processor. You're probably not using a folder called "workspace"
Arc: w d:/workspace/raster so you may have it in "f:/geog621/raster" or some
Arc: &run makegrids other place. Use windows to see what the path name
Arc: q is. Backslashes (\) or forward slashes (/) can be used,
¾ Now display the rasters in a new it doesn't matter. But maybe you'll be typing
Arcmap document you create and
name testras3.mxd. Ignore the w f:/geog621/raster
message about the layers missing
spatial reference information – they I can't give you the specific path, because it depends
are not projected areas of the earth but on where you put it.
are in a simulated area. Use the
Effects toolbar to set the transparency If you do this command wrong, you'll see the message
for overlapping rasters to about the Unable to change workspace.
Effects toolbar to set the transparency If you do it right, you'll see the message
for overlapping rasters to about 30% WARNING: New location is not a workspace.
or so. In the table of contents, set the
color for cells with values greater than I know that sounds ominous, but it just means that it
zero to distinct colors: 1 (red), 2, found the folder, but is just warning you that the folder
(green), 4 (yellow). hasn't been configured as an ArcInfo workspace. The
AML will run just fine, since I've included all the code
it needs to create a valid workspace.
5-7
Cell Width Settings
The cell width setting in the Spatial Analyst Options has several options:
Basically, you can either (1) set it to the largest size from the input rasters (Maximum of
Inputs); (2) set it to the smallest size of the input rasters (Minimum of Inputs); (3) set it
directly (As Specified Below) by typing in a value into the Cell Size box; or (4) reference
a raster for a cell size (e.g. “Same As Layer “one”).
Experiment with each of these options to see how they work. For each experiment, use
the Raster Calculator to derive temporary rasters that are the sum of one and two, using
the following expression (make sure to include spaces around the + sign):
[one] + [two]
? When you used Minimum of Inputs, which of the rasters (one or two) is used to
determine the cell size?
? Try setting the cell size to a large value like 5. What does this show?
5-8
Setting the Analysis Extent
The extent settings include the options to use:
a. (Same As Display) the extent of what is currently
displayed. For example, to create a raster covering a
small area you've zoomed into, this is the setting to
use. Note that if you change the display after you
make this setting, the new display change will have
no effect, unless you bring up Analysis Properties
again and use the setting "same as display"
b. (Intersection of Inputs) only those cells common to
all input rasters
c. (Union of Inputs) all of the areas covered by the input rasters
d. (As Specified Below) values specified in the boxes
e. (Same As ….) values representing the extent of an existing raster or other layer.
¾ As we did with cell sizes, experiment with the various settings while adding one and
two together to create temporary rasters for display. Try adding four into the mix as
well – raster calculations are not limited to two rasters. Again, use the cell tools to
explore the result. Note: to see the effect of setting the extent, you should set
Symbology to display nodata as something other than transparent. To make the
results consistent, set the Analysis Cell Size to "Maximum of Inputs".
? What is the effect of the Union setting? (Note: you need to display the nodata cells as
black, not transparent, to see the effect.)
? Try setting the extent to Same As Layer “Four”, and adding one and two as before.
Remember to display nodata as a color. What is the effect?
5-9
? When would this be useful, or other “Same as (raster)” operations be useful?
You can of course control both cell width and extent. You may have already been
experimenting with this. If not, here’s a simple demonstration:
Create a raster with values of 5 everywhere, and setting the cell width and extent. Use
“As Specified Below” for both, using Left = 0, Right = 50, Bottom = 0, Top = 50 as the
four settings for extent, and 1 as the cell width. The Raster Calculator should use 5 as the
expression. If you get an error, it’s probably because the environment setting is wrong.
Snapping to a raster
Sometimes you want your cells to align exactly with a particular raster (like an elevation
model) yet your spatial extent needs to derive from another raster (like a study area).
Let’s say that raster one represents your study area, and raster two represents the raster
you want cells to be aligned with.
¾ Set the cell size to be the same as layer two, the extent to be the same as layer one,
then set the extent to be As specified – this will leave it the same as the most recent
setting (don’t change it), then set the Snap Raster to layer two. Now use the raster
calculator to, again, add one and two. Make sure to display nodata in the result.
? What was the effect?
Review Questions:
? In general, what process creates a temporary raster vs. a permanent one?
5-10