L10 Raster Analysis - ArcPro
L10 Raster Analysis - ArcPro
There is a mix of old and new functions used in this lab. We’ll explain the new,
but you are expected to review old labs if needed to apply the old.
You should read chapter 10 in the GIS Fundamentals textbook before performing
this lab.
Data are located in the \Lab10 subdirectory, including Valley3 and Valley9, three-
and 9-meter DEMS of a portion of southeastern Minnesota and mardem, a 30
meter resolution raster elevation grid, and Shasta, a 30m DEM in northern
California. Also provided is a DEM for the Duluth area and a DuluthNorthRoads
layer. All data are in NAD83 UTM coordinates, Z units in meters, the Minnesota
files in zone 15, and the California file is in zone 11.
What You’ll Produce: Two maps. First, as practice, you’ll create a mosaic of
the valley DEMs. Then you’ll fix the Shasta DEM and produce a hillshades
corrected elevation map. Then you’ll create the second map, a cost surface with
an applied threshold, and some of the intermediate data used for the cost
surface; all these 4 parts of the cost surface exercise will be on the same layout.
In our first project, we will mosaic data of two different resolutions. We often
have data from various sources, for example, DEMs at approximately 30m and
10 m for most of the U.S. and 3m resolutions or better for a small subset of
areas.
Our first task here will be combining two DEMs, valley3, at 3-meter cell size, and
valley9, with a 9-meter resolution. We want to use the higher resolution data
where we have it but use the lower resolution data elsewhere.
1
GIS Fundamentals Lab10: Introduction to Raster Analysis
Start ArcGIS Pro and add both the valley3 and valley9 DEMs to an empty Map
Frame. (If valley3 or valley 9 don’t load; delete your entire Lab10 folder and copy a new, fresh copy of the entire
folder to your L:\home and try again)
Calculate the hillshade for both data sets (using standard default settings and
Model shadows) (Analysis→Tools→ArcToolbox→Spatial Analyst Tools –>
Surface –> Hillshade).
Inspect these hillshades carefully, and note the enhanced detail with the 3 meter
DEM, as shown below. The figure on the right is from the hillshade of valley3, on
the left the valley9. Note the greater definition of the small streams and
streambanks.
Remove the two hillshades from the data view to reduce clutter.
Resampling
To avoid unforeseen results, we should
first convert our data sets to a common
resolution, in this case the 9 meter data to
a 3-meter cell size. This does not make
the 9-meter data better. Basically, we are
making a copy of the data at a finer
resolution. (Video: Resample)
2
GIS Fundamentals Lab10: Introduction to Raster Analysis
Use Analysis –> Tools–>ToolBox –> Data Management Tools –> Raster –>
Raster Processing -> Resample
After the resampling is done, examine the valley9to_3 and verify that it
has a 3-meter resolution, either via the table of contents – properties,
then source/raster information, or by zooming on the map and using
the measure tool.
Although there are many ways to do this, perhaps one of the simplest is with
clever use of two raster functions – IsNull and Con. The textbook describes
these in detail, but in short,
the IsNull returns True
whenever a cell comparison
or value is Null. The con
function takes three values,
the first is a true/false test,
and second is the value to
assign to an output grid if
the test is true, and the third
is the value to assign if the
test is false. (Video: Raster
Calculator)
Con(IsNull("valley3"),"valley9to_3","valley3")
3
GIS Fundamentals Lab10: Introduction to Raster Analysis
Be careful to type the expression as shown, the operators are case sensitive,
meaning “con” is not the same thing as “Con”. The Raster Calculator is a rather
rigid parser. It is easy to add extra spaces and other minor syntax errors that will
keep your expression from executing. Pick the operators from the Tools or
Raster windows, when possible and enter data via the keyboard only when
necessary.
This function first tests if the cell of Valley3 is Null. This is true everywhere in our
study area outside the data region of Valley3. When the value is Null, the con
function assigns the value found in Valley9_to3 to the cell in the output data set.
When the value is not Null, the con function assigns the value found in Valley3.
Examine the combineDEM raster. Compute and inspect a hillshade and verify
that it has the higher detail contributed by the Valley3 data set.
Add a new empty Map Frame and remove the Map Frame that contains the
valley data. (Practice is over, this is start of the 1st turn-in exercise)
Raster Filters
We’d now like to introduce filtering as a
tool to fix “noisy” data. This is often
used with interpolated surfaces,
particularly LiDAR data, and similar
tools are used near edges for mosaiced
DEMs and other continuous surfaces.
Filters are described in Chapter 10 of
the GIS Fundamentals textbook.
Inspect the output hillshade layer and notice the funny artifacts. These are both
data “spikes,” white points with a long thin shadow trailing to the southeast, or
“pits,” dark areas on the northwest with a white “edge” on the southeast.
How do we remove these? As described in the text, we may use a low-pass filter
to identify and get rid of this speckle.
We may apply a low-pass filter to the SHASTA dem (not the Hillshade) with the
Analysis –> Tools–>ToolBox –> Spatial Analyst Tools –>Neighborhood –>
Filter command.
4
GIS Fundamentals Lab10: Introduction to Raster Analysis
Specify the Shasta DEM as the input, and a filter type of Low pass, and specify
an output name, like Shasta_lo.
Run the filter, calculate a hillshade for this new layer, using the default
parameters, and do not Model shadows. Inspect the output, looking at the areas
that have previously had spikes and pits (zoom way in). The before and after
figure below left and right, show the same corresponding area above, it shows
the reduction in the size of the spikes and pits, although they are still visible.
We could stop here, and just accept the filtered data layer. But if we look
carefully at the filtered and unfiltered hillshade, we’ll see we pay a cost for
filtering. We lose some of the fine detail, apparent in the image of the unfiltered
hillshade to the left, below, compared to the filtered hillshade to the right.
5
GIS Fundamentals Lab10: Introduction to Raster Analysis
The figure at right shows a zoomed in version of the hillshade of the difference
output, with the largest differences at and around the spikes and pits, seen as
squares of contrasting shades. (Shown for
your information; you do not need to create a
hillshade of your difference layer)
We can open the Analysis –> Tools–>ToolBox –> Spatial Analyst Tools
→Map Algebra→Raster Calculator, and
apply the following function, also shown within the raster calculator in the figure
following:
6
GIS Fundamentals Lab10: Introduction to Raster Analysis
We could apply the filter successively, and average the
local points further, and apply the Con function to a
difference layer again. It would lead to an improved
surface, and we would do this if we were using the data
for a project where the noise reduced our accuracies.
But since you won’t learn much new with repetition
here, we’ll just produce a map and move on to project 2.
Make sure you model shadows in the shaded relief surface (points will be
deducted if you do not – we need it to evaluate how well you’ve applied the
filtering). Create a Layout as shown below, add a reasonable legend, name,
north arrow, description, and scale bar, and export the map as a .pdf. In the
figure below, the symbology stretch type is set to Standard Deviations, n=1.5
7
GIS Fundamentals Lab10: Introduction to Raster Analysis
We will create a cost surface for locating a building. Our cost surface will depend
on slope and distance to existing roads. In our problem, we will assign a road
construction cost of $25 per meter of road required. We have a vector data layer
of roads, digitized from USGS maps, and we will use grid functions to convert
this to a cost data layer.
Slope also affects access costs, because roads on steeper terrain are more
expensive. The cost is nonlinear, increasing slowly at first for low slopes, then
more rapidly at steeper slopes. The relationship is not linear, in that it is more
than 10 times as expensive to build a road on a 20% slope than a 2% slope, and
impossible to build over a steep threshold.
We provide both a roads data layer and a distance data layer. You will calculate
a slope cost using the raster calculator. We use a few formulas for a very crude
m3odel of costs, a more accurate analysis would require much more complicated
processing, but our approach gives you the general idea while gaining practice
with raster calculations.
We will then calculate a distance cost, and then total cost by adding both layers.
We will then add these two cost layers. Finally, we wish to apply an upper
threshold of $25,000 to consider only those areas that are within our budget.
8
GIS Fundamentals Lab10: Introduction to Raster Analysis
9
GIS Fundamentals Lab10: Introduction to Raster Analysis
We use the Con function in the Raster Calculator, applying the condition as
shown below,
Our formula states that is $1000 times the slope factor, starting at 0 extra dollars
for a flat (0 slope) surface.
Using the raster calculator as shown above, we can derive a slopecost raster.
Any idea why the final -1000 at the end of the formula? What is the exp(0)?
10
GIS Fundamentals Lab10: Introduction to Raster Analysis
11
GIS Fundamentals Lab10: Introduction to Raster Analysis
(Video:Distance)
You should get something that looks like the above figure, depending on your
color ramp: (used in this image “classify with 5 Natural Breaks (Jenks))
12
GIS Fundamentals Lab10: Introduction to Raster Analysis
))
13
GIS Fundamentals Lab10: Introduction to Raster Analysis
You should get a layer with range of values approximately from 0 to 350,000.
The high end is from the steepest slopes, and it is a long-tailed distribution,
meaning there are few, very high values which skew the symbology stretch, and
obscure much of the variation.
If we cut off the stretch at 10,000 (see figure at right), then we show more detail.
Note the drop-off near the roads at this stretch, with a threshold above 10,000
reached due to the distance function.
14
GIS Fundamentals Lab10: Introduction to Raster Analysis
In a permanent
reclassification, output
values are saved to a
new raster.
We wish to consider only areas where the total costs are below $25,000
We need to create a mask, with 1 where the total cost is below $25,000, and
NoData where the total cost is above $25,000
Review the video Reclass for instructions on how to use the Reclassify tool
15
GIS Fundamentals Lab10: Introduction to Raster Analysis
16
GIS Fundamentals Lab10: Introduction to Raster Analysis
Use the raster calculator to multiply the mask (“classmask”) by the total cost
(“totcost”) layer (instructions not shown, refer to earlier parts if you are unsure
how; (hint: see the geoprocessing tool we introduced at the bottom of page 3 in these instructions)); call
the output something like Final_Cost.
17
GIS Fundamentals Lab10: Introduction to Raster Analysis
Use a contrasting color for the mask, and color the distance and slopes costs
and the final cost as graduated colors, Include the appropriate legend for the
layout, with a title, name, north arrow, legend, and scalebar
(Video: MapSize&Scale)
18
GIS Fundamentals Lab10: Introduction to Raster Analysis
19