0% found this document useful (0 votes)
27 views19 pages

L10 Raster Analysis - ArcPro

Uploaded by

Nabaraj Negi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views19 pages

L10 Raster Analysis - ArcPro

Uploaded by

Nabaraj Negi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

GIS Fundamentals Lab10: Introduction to Raster Analysis

Lab 10: Raster Analyses


What You’ll Learn: Spatial analysis and modeling with raster data. You will
estimate the access costs for all points on a landscape, based on slope and
distance to roads. You’ll then apply a threshold to this access cost.

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.

Project 1: Raster Resampling, Combination, Filtering


We often obtain DEM data with various errors, a cell size different that we wish to
have, or at different resolutions for different parts of our study areas. We may
use raster operations, or functions, to improve our DEM data.

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.

We can use the raster calculator to join


these two data sets. Note that we want to
use the detailed valley3 data where we
have it, and the coarser valley9 data
everywhere else.

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

In the resultant window, specify the valley9 as input, an output filename, a 3-


meter cell size, and a bilinear resampling (the textbook describes the differences
among resampling methods). Name the output raster valley9to_3.

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.

We can now combine the two data sets.

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)

Using the Raster calculator,


we can nest these functions:

Analysis –> Tools–


>ToolBox → Spatial
Analyst Tools → Map
Algebra → Raster
Calculator

Con(IsNull("valley3"),"valley9to_3","valley3")

Name the output something like combinedDEM

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.

Now we’ll look at another way to fix DEMs with errors.

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.

Load the DEM named Shasta, and


calculate a hillshade surface for the
Shasta DEM. Leave the Azimuth as is, set the Altitude to 25, and check the
model shadows box.

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.

We’d like to keep both, and we can.

First, we should subtract the filtered DEM layer


from the original Shasta layer. (remember not to
accidentally use a hillshade layer; Hillshades are used for
visual reference, seldom for any analysis)
Analysis –> Tools–>ToolBox –> Spatial
Analyst Tools →Map Algebra→Raster
Calculator

Select the following in the Raster Calculator


"shasta" - "shasta_lo"
Name the output difference.
(see figure at right); then Run.

Calculate the hillshade for the difference layer


you just created.

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 now then replace the cells were


the difference is large. Here, large is a
relative term, but after a few trials, and
looking at the difference histogram, a
threshold of about 15 works fairly well.

We want to replace the cells in the


shasta image when they are more than
15 meters different from the filtered
surface. Otherwise, we leave the Shasta surface alone, and hence, we don’t get
any of the degradation in detail in otherwise good data.

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:

Con(Abs(“difference”) > 15,


“shasta_lo”,”shasta”)

If the absolute value of the difference is


greater than 15, we write the filtered
value to the output. Otherwise, we write
the original data value.

Name the output something like


smoothed.

We can verify that this is helpful by


viewing the hillshade of the output
raster (again using default parameters
and not modeling shadows), and
comparing it to the original, and the
filtered surfaces. Note that we have
removed much of the speckle but
maintained the detail.

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.

For display, calculate a hillshade of the smoothed


raster, name it something like HillSmooth. Use an
altitude of 35 degrees and model shadows.
Add the shaded relief (that is the HillSmooth), making it
semi-transparent (50-60%) over the smoothed elevation
data. (See box at right for a “check” of the values of your layers to this
point; check the value ranges with your results”)

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

Project 2: A Cost Surface

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.

Start ArcGIS Pro.

Create a new project, add a map,

add the raster DulNorthDEM, and

calculate the percent slope,


Analysis→Tools→Toolbox→Spatial
Analyst Tools→Surface→Slope

Specify and remember the name you


assign for the slope layer, here I use
Slope_tif1

8
GIS Fundamentals Lab10: Introduction to Raster Analysis

Add the output slope surface to


the map and inspect it. Use the
cursor and the TOC slope layer
Properties –Source tab. What
are the slopes? What are the
highest and lowest values? Do
they appear reasonable?

Next apply a formula that determines the cost of building on slopes:

Left click on Analysis→Tools→Toolbox→Spatial Analyst Tools→Map


Algebra→Raster Calculator

Use the mouse to select the equation


Exp(“Slope_tif1” * 0.2) as shown in the
window at right, where “Slope_tif1” is
the name I chose for my slope layer in
the previous calculations. You should
substitute your slope layer name if it is
different.

This applies an exponential function to


each cell value and saves it in the
output raster slope_exp.

If you inspect the output, you’ll note it


has a lowest value of 1, and a very
large highest value, something like 2.38
x 1022 (note image will appear almost solid black)

We need to shave off the highest end,


as it can cause functions to calculate
too large a value later. We want to
place a ceiling on values over 300.

9
GIS Fundamentals Lab10: Introduction to Raster Analysis

We use the Con function in the Raster Calculator, applying the condition as
shown below,

Con((“slope_exp”) > 300, 300, “slope_exp”)

Verify for yourself that this makes


sense – remember it is

Con (condition, value if condition is


true, value if condition is false)

The thumbnail below shows a


green to red color ramp applied to
the symbology, with the red areas
showing steepest slopes.

We now calculate slope costs.

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.

Apply the formula “slope_exp300” * 1000 – 1000

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

Assign the symbology as shown at right.

Note we’ve specified the Min-Max stretch type,


with custom statistics, and

specified 0 Min, 25000 Max in the Options


(Video: Custom Ramp)

Compare your Map to the thumbnail image


below to verify your slopecost function is
calculated correctly.

You should have something that looks like this,


when applying a max-min symbology over the 0
- $25,000 range to your slope cost.

11
GIS Fundamentals Lab10: Introduction to Raster Analysis

Add the DuluthNorthRoads vector layer to your


map.

Save your Project before going any further!

Calculate the distance from roads raster, via


Analysis→Tools→Toolbox→Spatial Analyst
Tools→Distance →Legacy→Euclidean
Distance.

• Use DuluthNorthRoads as the input

• Name the output raster distance.

• Set the cell size to 3

• Don’t specify an output direction raster

• Distance Method Planar

(Video:Distance)

(Note: if this operation runs but never seems to


end; i.e. stays at 2%. You can try to Cancel the
operation but that might not work. You may
have to Exit ArcGIS Pro or select the top Citrix
Dropdown and open Task Manager and end the
ArcGIS Pro Task. You can also restart Citrix.

When you get your Project back open you can


try: Select the DuluthNorthRoads in the Table of
Contents, Data, Export Features, use the default
output name, Run; then repeat the Euclidean
Distance on the new copy of the roads.

IF ALL ELSE FAILS use the distance layer we


created for emergency L:\FNRM3131 or 5131
\Lab10\distance_if_yours_doesnt_work.tif.
This layer is already complete, just use it for the
next step)

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

Now: Calculate distance cost, as $25


per meter:

(used in this image


“classify with 5 Natural Breaks (Jenks

))

Now add the distance and slope


costs, to calculate a totcost surface.

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.

The detail is shown in the thumbnail of the layer below.

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

We now introduce permanent reclassification. This is a conversion from one set


of numbers to another, into a new raster. We do this in a raster GIS through a
reclass table. This table has a column for input values (Old values in the figure
below) and a column for output values (New values in the figure below). Each
cell value is examined, and input value matched to an entry in the table, and the
corresponding output value reassigned according to the table.

For example, the table at


right specifies that all Old This is an example
values between 0 and This data not is used in this lab!
200 are assigned a new
value of 0, values
between 200 and 400 are
assigned a value of 1
and values from 400 to
10,000 are assigned a
value of NoData.

In a permanent
reclassification, output
values are saved to a
new raster.

This is different from reclassification when we specify the symbology. Up until


now you’ve been specifying lists of values for coloring a display. No data are
changed in the source file, nor are new files saved. In previous lessons we have
only performed reclassifications for display. Today we will perform a permanent
reclassification. It is easy to get confused, because the classify menus are similar
these two classifications.

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

Start the tool by ArcToolbox→Spatial Analyst Tools→Reclass→Reclassify.

15
GIS Fundamentals Lab10: Introduction to Raster Analysis

In the reclassification window (not shown), set the


− Use totcost as your input layer,
− Add entries by filling in the start, end, and new fields. When you finish a row,
a new blank one should appear below.
− The first row should Old values of 1 to 25000 to New values of 1,
− The second row should assign values above 25000 to NoData. Here we
specify the largest value, 350000, but any number larger than the largest
value in the data set will.
− Add a row that assigns NoData to NoData
− Place the output in a raster
named classmask

This should result in a


reclassification table as shown at
right:

Click Run to execute the function

16
GIS Fundamentals Lab10: Introduction to Raster Analysis

This should result in a


mask layer called
“classmask”

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.

It should look something like this:

Create a 4-panel pdf map of your work:

Create a composite layout with four


separate maps on the same layout.

You’ll have to create maps with 1) the


distance cost layer,
2) another map with the slope costs layer,
3) another map with the mask layer, and
4) a map with the final cost layer.

17
GIS Fundamentals Lab10: Introduction to Raster Analysis

Add the roads layer to each map.

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

Note that you should make all of


the maps the same size in the
layout view.

You can do this by right clicking on


a frame, and then selecting

Properties then Display Options


in the formatting pane at the right
of the main window,

then modifying the scale.

Experiment with scales to find one


appropriate for the maps, then use
the same one for all maps shown
in the layout.

(Video: MapSize&Scale)

You should turn in a map that looks


something like:

Note: your Distance and Slope surfaces


should be stretched over the same
range as the Final Cost surface (use
Symbology, Stretch, Stretch Type =Standard Deviation 2, Statistics = Custom, Max =25000, and also
change the Label value to $25,000 )

18
GIS Fundamentals Lab10: Introduction to Raster Analysis

19

You might also like