You are on page 1of 12

Ras.1.

Introduction to Spatial Analyst & Raster Display


The Spatial Analyst extension of ArcGIS uses raster methods primarily and is very
similar to the GRID product which runs in Arc/Info. Both employ the concepts of map
algebra first introduced by Dana Tomlin with the Map Analysis Package. Both work as
extensions to a primarily vector-based system to provide a combination raster-vector
toolkit.

The locations of datasets we’ll be using are found in the data folder on the Ptolemy
server. To copy them all, copy raster from \\ptolemy\data\courses\g621\ (enter this on
Start>Run to pull up a window, or use the Ptolemy data shortcut on the desktop to look in
courses\g621) to your work folder – you should have been introduced to this in class, but
this most likely is a mapped work folder on the network or a local workspace on the
computer you’re using (probably D:\Workspace). Remember that local hard-drive data
should be backed up to your network folder before you leave on a given day.

We'll primarily be using one of the workspaces in the raster folder:


hmbarea On the San Francisco peninsula near Half Moon Bay, part of a vector
dataset we use for Arc/Info-based GIS classes, with several coverages converted
into rasters.

Starting ArcGIS and exploring Help system


First, you should get in the habit of saving your map
documents frequently. Use the name ras1.mxd for the
first exercise, ras2.mxd for the second, etc., and save
them to the raster folder.

To start we must be in ArcMap, and make sure we have


chosen Spatial Analyst as an extension. To open the
Extensions dialog box, choose the Extensions command
from the Tools menu in ArcMap Tools: Extensions,
then check Spatial Analyst, if it is not already checked.

Enabling an extension does not cause the extension's


user interface to appear automatically; it simply enables
any controls that the extension provides. If the
extension's controls are on a toolbar, such as the Spatial
Analyst extension's toolbar, you will still need to
display the toolbar by choosing it from the Toolbars
pullright in the View menu.

View: Toolbars, then check Spatial Analyst, if it is not


already checked.

1-1
The ArcGIS Spatial Analyst help system
There’s a lot of information there, but it takes a bit of time to get used to using it.
ArcGIS and extensions use the standard Windows help, so if you’ve used that, you’ll
hopefully find it familiar.
¾ Start by making the menu choice
Help>ArcGIS Desktop Help…

¾ Spend some time exploring the help


system, which includes three
convenient ways to find what you’re
looking for, each accessed through a
separate tab:
Contents: a hierarchical table of
contents system, which organizes
help topics;
Index: an index view, similar to a
book’s index, where key words
that would be found in an index link you to different subjects; and
Find: a search method, which looks throughout the system to find any mention of words
you are searching for. This takes a bit more time and effort but can find things the
other two systems miss. (It can also find a lot of things you don’t want, so you’ll
have to wade through them.)
Favorites: a personalized list of favorite Help topics. This list is saved so that it appears
each time the Help system is opened.

Start with the Contents tab, and scroll down through the topics. One of these topics will
be Extensions, and within that you’ll find the extension Spatial Analyst.

¾ At this time, spend some time exploring the Spatial Analyst section of the help
system, in order to get an understanding of the scope of the system.
¾ For now, read through the various sections of “Understanding Raster Data”.
Understand concepts such as cells, rows/columns, attributes, discrete/continuous data,
and:

? What is meant by “progressively varying continuous data”?

™ Eventually we’ll be getting to Map Algebra, and you’ll find much more on that here.
The Spatial Analyst section provides access to the most comprehensive information
about individual commands, functions, operators, and methods available in Spatial
Analyst. When we learn about individual functions or tools, like slope, focalflow,
and others, you will also find the help system useful for looking up syntax for that
tool.

1-2
Adding a Raster Layer to a Map
¾ We’ll start by exploring our data. Click the Add Data button to bring up the Add
Data catalog browser. Navigate to the folder where the exercise data resides and
open the landuse raster.

¾ If you’re familiar with ArcMap, it should all look familiar, except for an added menu
toolbar (Spatial Analyst). You may need to add the toolbar, from the View menu.
¾ Turn the land-use layer on by clicking its button in the legend area [this should be
checked automatically when you add the data to the dataframe]. Note that the raster
is symbolized much like a feature layer in ArcMap, with different colors for each
category of land use/land cover, though the Anderson numeric land-use/land-cover

codes (11, 12, etc.) may not mean much to you. To find some meaningful
descriptions we could look in the attribute table.
¾ Bring up the attribute table for the landuse raster [Right-click on the layer and select
Open Attribute Table]. Landuse codes are categorical, and use integer numbers for
storage, in contrast to continuous variables like temperature which are stored as
floating-point. Integer rasters have VATs (Value Attribute Tables) which are very
similar to Feature Attribute Tables of feature layers. There are two standard fields,
Value (the main integer code used with the raster,
used for map algebra -- more on this later) and
Count (the number of cells having that value.

™ Note that there is only one record for each


Value. If you were to look at a vector attribute
table, you'll see one record for each polygon,

1-3
and more than one polygon can have the same value (for instance, more than one
part of a city might be residential land use). While you can have patches of
contiguous cells of the same value, those patches are not features, they are just
cells with the same value. Later on, we'll look at using patches as zones and
regions.

¾ Back in the dataframe, change the legend


(double-click) to use the descriptive landuse
names in Lu-desc. Then select a better color
scheme.

¾ Add some vector features -- roads and


streams [hint: ]

¾ Then change the Dataframe name (Right-


click on the dataframe in the Table of
Contents [it will be called Layers by default]
and select Properties. Under the ‘General’
tab change the name to Land Use/Land
Cover).
¾ In the layout view, add a legend of land use categories
(don’t include roads and streams in the legend, since
they are obvious and you’re not symbolizing different
types), a scalebar of meters, and make all fit the upper
half of the letter-size page. A scale of 1:100,000
should be about right.

 Export your map (File/Export Map…) to an .emf


file – call it lumap.emf -- using the Options
setting (you must pull down the Options area) to
clip the output to the graphics extent.
Then create a Word document using
your last name followed by the
exercise number and the exercise
abbreviation (like Smith_ras1.doc,
and save it in a Reports folder,
which should be in your Y: “drive”)
to put this and later figures in. In
Word, Insert/Picture/From File… to
insert your map as a figure. Add text
to describe what the figure shows.
You’ll be adding more to this
document, so you can leave it open,
but save before you return to
ArcMap.

1-4
Displaying cell attributes and data selection
Displaying data from raster cells has some interesting
differences from the vector equivalent; though so far, with
the exception of a bit of difference with the attribute table,
using a grid (raster) layer seems little different from using a
feature (vector) layer. Let's see how they're different by
zooming in.
¾ Use the zoom-in tool to zoom into a location on the
view. Drag a rectangle with this tool to quickly zoom
into (approximately) the area shown here:

When you zoom in, the differences between


raster (grid) and vector (feature) layers
becomes apparent. The raster layer is
composed of square cells, while the vector
layer is a series of lines from vertex to vertex.

¾ Make sure the landuse raster is set as the


identify layer. Use the identify tool and
click on the map. Change the Identify layer
from <Top-most layer> to landuse and click
anywhere on the raster. See how this works
with rasters. Note that with integer rasters, this has a very similar effect to identifying
features in feature layers.

? Note that you cannot select cells in a raster


using the select feature tool. What does this
tell you about what the identify tool was
showing you, and how a raster differs from a
feature layer?

¾ To help us better understand the different


ways rasters and feature layers are handled,
let's try to select cells another way. First,
restore the original scale of the view [Right-

1-5
click on the landuse raster and select Zoom to Layer], then open the attribute table
[Remember: Right-click on the layer and select Open Attribute Table ]. Select a
record corresponding to "Evergreen Forest". With the dataframe visible, note that the
corresponding cells are turned cyan.

? How does this differ from selecting features from a feature attribute table?

[If you're not sure, try the same operation(s) with a feature layer -- there's a land-use
shapefile in the dataset, named lu.shp. Note the correspondence between table
records and land-use polygons, and how more than one polygon can have the same
value. Then look at the raster layer table. What's different?]

¾ For another view of the landuse raster layer, make this layer the target layer in the
Spatial Analyst Toolbar and click the histogram button .

You will probably have to enlarge the


graph to see all of the legend.

? Specifically, what do the numbers on


the Y axis mean?

What is the most common category?

1-6
¾ We can get selective with
the histogram by displaying
it only for a set of raster
cells. One way to do this is
to select an area on the map
with a graphic. There are
many types of graphics in
ArcView; we'll use a
rectangle. When you create
another histogram, only the
cells within the graphic are
considered. Note: you must
be in data view, not in
layout view.

 Choose a histogram of land


use, either of a selection or
of the whole area, and insert it into your report.
The easiest way is to right-click the blue title bar
of the histogram window, and Copy Graph to
Clipboard, then go to Word and Ctrl-V to paste it.
Add some text explaining what the histogram
shows.

The difference with floating-point rasters


So far we've been looking at an integer raster, composed of categorical data. Think of
these as being as easily modeled in raster or vector mode, since they tend to have discrete
boundaries. The VAT (value attribute table) of rasters is comparable to the FAT (feature
attribute table) of vector features.

Floating-point rasters, in contrast, do not tend to represent phenomena with discrete


boundaries, but more often represent continuous variables; the raster is often a sample of
a continuous "surface", where values may change continuously from one point to any
other point. For example, elevation varies continuously, as do a variety of elevation-
derived variables such as slope angle and aspect. Temperature is measured at points --
weather stations -- but a temperature "surface" can be created by interpolating values for
locations in between stations. Groundwater surfaces can also be interpolated using well
(point) data.

It is with continuous variables that raster-mode GIS really has advantages.

1-7
? Before we start, why do
you think there is no VAT
with floating-point rasters?

Let's have a look at how we


can display floating-point
rasters.

¾ Insert a new dataframe, and


add the elev (elevation)
layer. Turn it on if it is not
automatically.

Note the difference in the


symbolization. ArcMap
displays floating point
rasters by creating a classification of the range, then symbolizing using a stretched
color ramp.

¾ Change the symbology from a Stretched color ramp to a Classified color ramp by
bringing up the legend editor (double-click the elev layer in the legend).

See the effect of various ramps.


Experiment with different colors, or even
ramps from one color to another. Try
flipping the symbol order by clicking on
the symbol heading and select Flip Colors.

¾ Add feature layers to your view and


rename the view "Elevation".

¾ Explore cell values in elev with the identify tool .

1-8
? What does this tell you about the difference between integer and floating-point ?

? Create a histogram of elev. What is the most common range of elevations?

 Inset a histogram of elevation in your report.

Other Surface Representations


Spatial Analyst makes it pretty easy to represent surfaces in
other ways. There are six tools on the Surface Analysis menu
-- (1) Contour…, (2) Slope…, (3) Aspect…, (4) Hillshade…,
(5) Viewshed…, and (6) Cut/Fill – that provide some of the
most commonly used surface derivatives. Their use is fairly
self-explanatory assuming you are familiar with the concepts of
slope, aspect, shaded relief, viewsheds, and contours.

We’ll come back to these concepts later, but let’s first see how
they might display, which is our current focus. For each of the
four results, investigate what you have using the view display (turn it on), the identify
tool, the histogram button, and the layers properties menu (Right-Click the Layer and
select Properties…).
¾ Create a slope raster from elev. The result will be slope angle in degrees (for the
result in percent, we’ll talk about methods later on). Investigate the resulting slope
raster.
How do you tell what type of raster is
? What kind of raster (integer or float) is the created?
For any raster layer in ArcMap, either
resulting slope raster?
from a layer you’ve added or derived,
right-click the layer in the table of
contents, go to Properties, and look in
the Source tab at Raster Information
to see a variety of properties about the
source dataset for the layer – the cell
? Why would this be the result? size, columns and rows, etc. The Pixel
Type tells you whether it’s floating
point or integer.

¾ Create an aspect (direction of slope) raster from elev, and investigate it.

1-9
? What kind of raster is the result, and why?

¾ Notice how the legend is configured to be easy to use.

 Insert your aspect map into your report, with a legend.

¾ Create a hillshade raster. Use the default parameters, and investigate it.

? How is this raster useful?

? What type is it? Any idea why?

¾ Create a contour map from elev, using the default parameters, and investigate it.

? What kind of dataset do you get as the result from this analysis?

1-10
Displaying images and image-derived rasters
Image data collected from satellite sensors like LANDSAT and SPOT, or scanned from
aerial photography, can be displayed like a raster along with features. The benefits are
significant in terms of visualization and feature interpretation. This exercise will explore
the use of images for simple visual interpretation, and you'll use it to update land use
information from the area around Half Moon Bay.

Since both images and rasters are raster structures, you might expect that similar methods
can be used for displaying them. In fact, both rasters and images are symbolized as raster
datasets, though images cannot be manipulated or displayed as raster layers without
conversion. When you preview a single-band raster dataset, the value of each cell is
drawn as a color or a shade of gray depending on the data. When you preview a multi-
band raster dataset, i.e. Landsat Thematic Mapper image, three of its bands are combined
to form a composite image, where each band supplies either the red, green, or blue
display value.

From the Raster tab in the Options dialog box, you can choose which band will provide
which value. You can specify a different set of defaults, mapping bands to RGB display
values for datasets with three bands and those with four or more bands.

¾ Create a new dataframe, then add a 3-band false-color Landsat Thematic Mapper
image layer tmcomp.bil from hmbarea, using the Add Layer button .
¾ Explore this image layer with the various tools and buttons.

¾ Add some feature layers, like roads and streams, on this, and inspect the view to see
how well the image is registered.
Images can also be converted into rasters, allowing you to process them with the many
Grid commands.
¾ Create three rasters from the red, green and
blue bands of tmcomp.bil. You will need to
use ArcCatalog to convert the images to a
raster.
¾ Right click on the raster layer (tmcomp.bil)
in ArcCatalog and select Export > Raster to
Different Format.
¾ In the Output Raster Dataset box, set a name
for the grid you’re going to create, with no
extension (e.g. “outgrid”, not “outgrid.img”)
– extensions are used for tiffs “.tiff” and
ERDAS .imgs (“.img”). Since it’s actually
going to create a different grid for each
band, what will happen is a bit will be added

1-11
to each name: outgrid would be outgridc1, outgridc2 and outgridc3.
¾ Add the new rasters to ArcMap. To display these rasters like images, you will find
that a gray scale would be best [By default, ArcMap will display them in a grayscale
with a Stretched Classification].

 Add a map to your report, and finish your report. Save it in your Reports folder, then
create a pdf using the same naming convention, e.g. “Smith_ras1.pdf”.

This concludes exercise 1. To save all this stuff you’ve done so you can look at it again,
we’ll save the map document. But first, you might want to change paths as relative: go
to File/Map Properties and click the Data Source Options button to select this option.
This may help you work in more than one place. Save the map document in the raster
folder as ras1.mxd [File>Save As….]. Also if you’re leaving for the day, and you’ve
been using the local workspace on the hard drive, remember to back up your work to
your network folder.

1-12

You might also like