You are on page 1of 13

GIS Special Topics Workshop:

Using the Spatial Analyst Extension

Rhonda Houser,
Academic Data Research Services Alliance,
KU Libraries Instructional Services
www.ku.edu/~adrsa

Contents
Introduction.................................................................................................... 2
Objectives...................................................................................................... 2
Related Training Available ............................................................................ 2
Definitions...................................................................................................... 2
For More Information................................................................................... 12
Getting Additional Help ............................................................................... 13
2006 University of Kansas. All rights reserved

ADRSA Training: Using the Spatial Analyst Extension

Introduction
Delve into the nitty gritty of ArcMap using tools available through the Spatial Analyst extension.
This tool provides cell-based modeling and analysis functions for working with raster data in
GIS. Create, examine and combine grid data, and learn about differences between vector and
raster data. Calculate and examine distance, density, and cost relationships.

Objectives


Turn on Spatial Analyst extension and


toolbar

Generate density grids (calculate


concentration of features)

Convert data from vector to raster format

Reclassify grid data

Set analysis parameters

Add class labels to ranges of grid values

Differentiate between temporary and


permanent grids

Combine grids using grid calculator

Export grid table to another format

Generate distance grids (calculate


distance to nearest feature)

Calculate grid areas

Prerequisites
GIS I: ArcMap Introduction and GIS II: ArcMap Intermediate, or equivalent skills

Related Training Available


All workshops offered through Information Services are free to KU students, staff, faculty, and
approved affiliates. To learn more about or register for workshops, receive automatic
announcements of upcoming workshops, and track workshops you registered for and attended,
visit the KU Libraries Instructional Services Web site at http://www.lib.ku.edu/instruction/. You can
also check our online schedule at www.ku.edu/acs/schedule for a list of class offerings and
availability. For further workshop related questions, please email training@ku.edu.

Definitions
Term

Definition

cell count

column in raster attribute table; indicates number of cells having a


particular value.

cell value

column in raster attribute table; identifies or describes cell class,


category or group for discrete/thematic data using whole numbers
(integer data), or identifies or describes cell magnitude, distance or
relationship of cell to other cells for continuous surfaces using decimal
numbers (floating point data).

dbase (dbf)

database file format (*.dbf), the file format produced by Dbase, a


commercial relational database system; .dbf files comprise the tabular
- -

2006 The University of Kansas

ADRSA Training: Using the Spatial Analyst Extension

data file in GIS shapefiles and can be imported as tables into ArcGIS.
extension

tool or program that adds functionality to ArcView; a standard set of


extensions accompany GIS software; they can also be obtained from a
software vendor such as ESRI, and many are freely available online
from users who develop them based on their needs.

kernel density

same calculation method as simple density except lines nearer the


center of a cells search area (closer to cell itself) are weighted more
heavily, resulting in smoother distribution of values.

measure tool

click and drag to start measuring distances on the map; double-click to


stop; distance is simultaneously displayed at the bottom left of the data
frame (both Segment and Total distance are shown)

no data

value assigned to a cell when either no or insufficient information is


available about the ground area it represents

raster

type of spatial data in which features are represented by cells (or


pixels) with same value and cells are organized in a grid of rows and
columns; raster format is appropriate for data that vary continuously
over space such as elevation; images and grids are types of raster
data.

region

cells with same value (zone) that are connected.

resolution

cell size or pixel to ground ratio (one cell on the screen represents this
size area on the ground); all cells in a raster must be same size.

simple density

lines within search area (from each cell) are summed, then divided by
search area size to calculate each cells density value.

vector

type of spatial data in which features are represented by points, lines or


polygons; coordinate-based structure (XY or latitude-longitude)
commonly used to represent linear features; coverages and shapefiles
are types of vector data.

zone

multiple cells with same pixel value.

Copy data to hard drive for workshop

Click on Start (button)  Programs  ArcGIS  Data

Click once on the folder called spatial

Under File and Folder Tasks, choose Copy this folder

Make sure c:\ wutemp is selected and click on Copy

- -

2006 The University of Kansas

ADRSA Training: Using the Spatial Analyst Extension

Start ArcMap

Start Menu  All Programs  ArcGIS  ArcMap

Maximize ArcMap (click on

middle button, top right corner)

Bring in Data

Click on the Add Data button

Navigate to: c:\ wutemp\ spatial

Hold down the control (Ctrl) key and click on the following layers to add all at once:

to bring data layers into ArcMap

bikepaths.shp (bike routes in Lawrence, vector line file)


citypark.shp (park boundaries in Lawrence, vector polygon file)
dg_tighy.shp (streams and rivers in Douglas country, vector line file)

Click on Add

Click on the Add Data button

Navigate to: c:\ wutemp\ spatial

Select: dg_drg_u1583.tif (digital topographic map of Douglas country, raster file)

Click on Add

again to add a basemap

We will use data on bike routes, parks and streams in Lawrence, KS for this exercise. We will
use the data as indicators of recreational opportunities for residents. With Spatial Analyst, we
can ask:
-How far would a resident have to travel from any given location, to reach a city park, or to find
a bike trail or a stream?
-How close (convenient) and how concentrated are opportunities for outdoor recreation?

Set a Projection

Turn on all layers at once by holding down the control key and clicking in the checkbox of
one layer

Can you see all four data layers?

Zoom to Full Extent button

to see the land area data covers

Do all layers draw together in the correct location?


- -

2006 The University of Kansas

ADRSA Training: Using the Spatial Analyst Extension

Set the projection of the data frame (temporary) to match the projection of the topo map
(permanent):
UTM 15, NAD 83 (Universal Transverse Mercator projection, Zone 15, North American Datum
1983):

Choose View  Data Frame Properties

Click on Coordinate System tab

In the Select a Coordinate System window


choose:
Predefined  Projected Coordinate Systems
 UTM  NAD 1983 
NAD 1983 UTM Zone 15N

Click OK

Click Yes to messages about coordinate


systems

Zoom to Full Extent

Can you see all layers now?

Set Distance Units


Spatial Analyst (SA) functions are based on and expressed in the map units of data (meters in
this case). Distance units are those displayed at the bottom left of the screen when using the
Measure Tool.

Set display units to meters: Choose View  Data Frame Properties

Click on the General tab and notice Map Units (grayed out) and Display Units

Map units will always be meters for these data, or whatever unit as determined by a particular
projection, i.e. UTM projection units are meters.

Change Display Units to Meters

Activate Spatial Analyst Extension

Choose Tools  Extensions and check the box next to Spatial Analyst to make extension
available

- -

2006 The University of Kansas

ADRSA Training: Using the Spatial Analyst Extension

Choose View  Toolbars  Spatial Analyst to display toolbar (drop-down menu)

Set Spatial Analysis Options


The Options window allows the user to set parameters for all analyses in a particular project.
Analysis options can also be changed for each task.

Under SA menu  Options

Click on General tab

Set Working Directory: c:\wutemp (files generated in SA automatically saved here)

Set Analysis Coordinate System: Analysis output will be saved in the same
coordinate system as the active data frame (UTM Zone 15, NAD 83)

Click on Extent tab


o

Set Analysis Extent: Same as Layer bikepaths (area for which we have data for all
three vector files)

Click on Cell Size tab


o

Set Analysis Cell Size: As Specified Below

Set Cell Size: 30 (meters- based on map units of the data)

I. Generate Distance to Park Grid


- How close is a park (as the crow flies) from anywhere in Lawrence?
This function generates a grid (raster) layer in which each cell of the distance grid represents
the distance in a straight line to the nearest feature in the source grid. When the source data are
in vector format, the function automatically converts the data into raster (grid) format.

Turn off all vector layers except for parks and zoom out so you can see the entire layer

Select parks layer in table of contents

Under SA menu  Distance  Straight


Line
o

Output cell size: 30 (m)

Output raster: Temporary

Click OK

Notice progress bar at bottom left as


ArcView processes

Notice the default classes (ranges of


distance values) applied to the new grid

Click on any cell in the new grid with


Identify tool to obtain the actual
- -

2006 The University of Kansas

ADRSA Training: Using the Spatial Analyst Extension

pixel (cell) value

Zoom in to part of the Distance to parks grid and use the


measure the length of one grid cell

Measure Tool to

How long should it be?

Check grid cell size (resolution) in Layer Properties (double-click on Distance to parks grid
in the table of contents); Source tab includes X cellsize and Y cellsize
Check whether grid is temporary or permanent (Source tab)

Reclassify Cell Values of Distance to Park Grid


We want to reclassify distance values into standardized values that will be meaningful when
we combine this grid with others to create one grid. The values of this final grid will represent
different levels of recreational opportunities.
Select Distance to parks grid
Under SA menu  Reclassify
Make sure Input raster is Distance to parks and Reclass field is Value
Classes may be created manually; note buttons for Add/Delete Entries (classes)

Click on Classify button and note Classification Statistics

What is the average distance to a park from anywhere in Lawrence?


What is the maximum distance to a park from anywhere in Lawrence?

Choose Classification Method = Natural Breaks and Classes = 9


Click OK
Click in each row under New values
column to type in reclassify values
Do NOT click in the rows under Old
values
DO NOT HIT ENTER DURING THIS
PROCESS
If proximity to a park is desirable, 9 is
the optimal cell value in this grid.
Assign values of 1 to 9 to the cell
ranges, with 9 representing cells with
the smallest distance values, or
located closer to a park.
Give a value of 1 to cells furthest from
a park (largest distance values).
Assign classes in between values of 2
to 8 depending on their distance to a
park, in increments of 1.
Click OK

Note that long, complex or frequently used classification schemes can be saved and reloaded
Right-click on Reclass of Distance to parks grid, choose Make Permanent to save grid to
disk
- -

2006 The University of Kansas

ADRSA Training: Using the Spatial Analyst Extension

Save in c:\ wutemp\ as distpark (as ESRI Grid)


Remove temporary Distance to citypark grid from table of contents (Right-click on layer)
Right-click on Reclass of Distance to parks grid and choose Open Attribute Table to see
cell values (value field) and how many cells fall into each category (count field)
To change the way the grid is displayed (colors, patterns, etc.), double-click on layer and
click on Symbology tab
o Choose a Color Scheme that shows gradation (i.e. darker colors for lower values,
lighter colors for higher values or vice versa)
o Click on the Display tab and change the Transparent percent to 50 or a similar
value so this grid can be overlaid on the topo map for reference
o Click OK

II. Generate Bike Path Density Grid


- What is the relative density of bike routes in different areas of Lawrence?
The Density function is suitable for showing where point or line features are concentrated,
and generates a continuous density surface from input features.

Turn off all vector


layers except for
bikepaths

Select bikepaths layer

Under SA menu 
Density

Set Density type =


Kernel
Accept all other
defaults and click OK

Reclassify Cell Values of Bike Path Density Grid


Select Density of bikepaths grid
Under SA menu  Reclassify
Make sure Input raster is Density of
bikepaths and Reclass field is Value
Click on Classify button
Classification Method: Equal Interval and
Classes: 9
Click OK
DO NOT HIT ENTER DURING THIS
PROCESS
Assume higher density is preferable and
assign these classes the higher index
numbers. Reclassify cells with high density
of bike routes to an index value of 90. Assign
value of 10 to cells with low density of bike
routes. Assign values of 20 to 80 accordingly
to those in between.
Click in the first row under New values column
- -

2006 The University of Kansas

ADRSA Training: Using the Spatial Analyst Extension

Change the 1 to 10
Click in the next row and change the 2 to 20
Repeat for all rows so the last value (high density of bike routes) is reclassified to a value of
90, using increments of 10
Click OK
Right-click on Reclass of Density of bikepaths grid, choose Make Permanent to save grid
as a permanent file
Save in c:\ wutemp\ as densbike (as ESRI Grid)
Remove temporary Density of bikepaths grid from table of contents (Right-click on layer)
Change the way the grid is displayed (Layer Properties, Symbology tab) to a type where
higher values are represented by darker colors and lower values by lighter colors
Click on the Display tab and change the Transparent percent to 50 or a similar
Click OK

III. Generate Distance to Stream Grid


- What is the distance to the nearest stream from anywhere in Lawrence?

Turn off all vector layers except for streams


(dg_tighy)

Select streams layer in table of contents

Under SA menu  Distance  Straight Line


o

Output cell size: 30 (m)

Output raster: Temporary

Click OK

Reclassify Cell Values of Distance to Stream Grid


Select streams grid
Under SA menu  Reclassify
Make sure Input raster is Distance to
dg_tighy and Reclass field is Value
Click on Classify button
Choose Classification Method = Natural
Breaks and Classes = 9
Click OK
Click in each row under New values
column to type in reclassify values
DO NOT HIT ENTER DURING THIS
PROCESS
Close proximity to a stream is preferable,
so assign values of 900 (optimal value) to
cells with smaller values (shorter distance
to nearest stream)
Assign a value of 100 to cells furthest
from a stream (largest distance values).
Assign cells in between values of 200 to
800 depending on their distance to a stream, in increments of 100.
Click OK
- -

2006 The University of Kansas

ADRSA Training: Using the Spatial Analyst Extension

Right-click on Reclass of Distance to streams grid, choose Make Permanent to save grid
as a permanent file
Save in c:\ wutemp\ as diststreams (as ESRI Grid)
Delete temporary Distance to streams grid from table of contents (Right-click on layer,
choose remove)

IV. Combine Grids into One Outdoor Recreation Index Grid


Now add these three grids (reclassified) together to make one grid. This new layer represents
the input values for each grid for each cell, or location.
This SA function stacks the grids one on top of the other and adds the cell values at each
location (every 30 m sq area).
Each cell value in the resulting grid will be the sum of the cell values at that location for each
of the input grids.
9

We used reclassification values with differing numbers of


digits for the three grids. Cell values in the final grid
(combination of all three input grids) are coded to indicate
the input grid values:
1-digit numbers for distance to parks grid (1-9
with 9 as optimal value)
2-digit numbers for bike density grid (10-90 with
90 as optimal value)
3-digit numbers for distance to streams grid (100900 with 900 as optimal value)

90
900
999

Our index values for the three separate grids represent levels of outdoor recreation
opportunities.
Higher numbers represent shorter distances to parks and streams and higher density of
bike routes.
Under SA menu  Raster Calculator
Add the grids together by double-clicking on a grid, then single-click on an operator (+), then
double-click on a grid, etc. Build the following map calculator expression:
[Reclass of Density of bikepaths] + [Reclass of Distance to parks] + [Reclass of Distance
to streams]

Click Evaluate
Right-click on the Calculation grid, choose Make Permanent
to save grid as a permanent file
Save in c:\ wutemp\ as recindex
Identify tool to

Click on any cell in the new grid with


obtain the actual pixel (cell) value

Final grid (recindex) cell values range from 111 to 999, as the minimum possible summed value
is 1 +10 +100 and the maximum value is 9 + 90 +900.
Open the attribute table and sort the Value field in ascending order (right-click on column
heading)
- -

2006 The University of Kansas

10

ADRSA Training: Using the Spatial Analyst Extension

Reclassify cell values of Outdoor Recreation Index Grid


Select recindex grid
Under SA menu  Reclassify; Click on Classify button
o Classification Method: Natural Breaks and Classes: 3
o Click OK and OK again
Right-click on the Reclass of Calculation grid and choose Make Permanent to save grid
Save in c:\ wutemp\ as recindex2
Delete temporary Calculation grid from table of contents (Right-click on layer, choose
remove)
Add Class Labels to Final Grid
Double-click on the grid in the table of contents to bring up Layer Properties
Click on the Symbology tab and under the Value column, change 1, 2 and 3 to LOW,
MEDIUM, and HIGH, respectively. 3 is the highest/ most preferable value representing
recreational opportunity.
Change class colors if you want, by double-clicking on each color box
Click on the General tab and change the Layer Name to Outdoor Recreation Index or
something similar
Click on the Display tab and change the Transparent percent to ca. 50
Click OK
Turn on all other layers (with topo map on bottom and vector layers on top of grid)
Calculate the Area Covered by Each Index Level

Open attribute table of Outdoor Recreation Index grid

Click on the Options button and choose Export

We must export the grid table (convert to form more compatible w/ArcMap) to be able to edit
table (calculate area)

Export All Records and save to c:\ wutemp \default.dbf

Choose Yes at the prompt to add the new table to the table of contents

Click on the Source tab in the table of contents

Find the table you generated and right-click to open

Click on the Options button and choose Add Field


o

Name: areasqm

Type: Long Integer

Click OK

Right-click on the areasqm field title (top of column) and choose Calculate Values

Click Yes at the Field Calculator prompt

Set the values for the area (square meters) of each recreation index level (1,2,3) equal to a
single cell area (30m x 30m = 900m) multiplied by the number of cells that make up that
rec. index level (Count).

Your expression should look like this: areasqm = 900 * [Count]


- -

2006 The University of Kansas

11

ADRSA Training: Using the Spatial Analyst Extension

To add a field for area in acres:

Click on the Options button and choose Add Field

Name: area_acres

Type: Long Integer

Click OK

Right-click on the areaacres field title (top of column) and choose Calculate Values
o

Click Yes at the Field Calculator prompt

Set the values for the area (acres) for each recreation index level equal to acres
(square meters converted). Conversion factor: square meters / acres = 4047

Your expression should look like this: areaacres = [areasqm] /4047

Click on the Options button and choose Add Table to Layout to include the area values in
your map layout

Note: Please complete a workshop evaluation. An online evaluation


is linked from the internet browser Favorites menu. We value
your feedback.

For More Information


Other Spatial Analyst Functions

Convert point, line, polygon features to raster


format

Generate density maps from point features


(Density)

Find compass direction to nearest feature


(Straight Line Direction); What is the direction
of the nearest city?

Identify closest feature (Straight Line


Allocation); Which city is the closest?

Find shortest or least-cost path from source to destination (Shortest Path)

Create continuous surfaces from point features (Interpolate to Raster)

Derive contour, slope, view-shed, aspect, and hillshade data

slope- change in elevation on pixel/cell compared to surrounding pixels (degrees)

aspect- direction of slope (degrees)

hillshade- representation of landscape at different sun angles and elevations

ESRI: Using ArcGIS Spatial Analyst

- -

2006 The University of Kansas

12

ADRSA Training: Using the Spatial Analyst Extension

Perform map algebra- Boolean queries and algebraic calcs. (Raster Calculator)

Perform neighborhood and zone analysis

Carry out discrete cell-by-cell analysis

Perform grid classification and display

Use data from standard formats, including tiff, bil, img, usgs dem, sdts, etc.

Data Sources (data commonly used in spatial analysis)

US elevation data in Digital Elevation Model (DEM) format, also other basemap data
(USGS/ Geocommunity): http://data.geocomm.com/catalog/index.html

KS elevation data in Digital Elevation Model (DEM) format (Data Access and Support
Center): http://maps.kansasgis.org/kgcc/catalog/catalog.cfm

Numerous links for data downloads (Academic Data Research Services Alliance):
www2.ku.edu/~adrsa/data.shtml

Online Tutorial: Learning ArcGIS Spatial Analyst (workshops listed are freely available to
KU-affiliates): www.kars.ku.edu/user/vc_courses.shtml

Download extensions (add specialized functions to ArcView): http://arcscripts.esri.com/

Getting Additional Help


Online Tutorials- Learn GIS at your own pace through virtual tutorials. ESRI online tutorials are
available free to KU-affiliates and can be used by individuals or classes. See a list of courses at:
www.kars.ku.edu/user/vc_courses.shtml and email or call (data@ku.edu, mickey@ku.edu or
864-1238, 864-0454) to register for one or more.

GIS and Data Lab - 105 Anschutz Library


Hours (while KU is in session): Mon-Thurs 9AM-8PM, Fri 9AM5PM, Sat/Sun 1PM5PM
Contact: data@ku.edu or 864-1238 (Rhonda Houser)
More information: www.lib.ku.edu/gis
Last Update: 04/06/20066

- -

2006 The University of Kansas

13

You might also like