lab 10: raster analyses - gis courses...gis fundamentals lab10: introduction to raster analysis 3 we...

18
GIS Fundamentals Lab10: Introduction to Raster Analysis 1 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 \L10 subdirectory, including Valley3 and Valley9, three and 9 meter DEMS of a portion of southeastern Minnesota, mar_rd83.shp, a vector road layer, and mardem, a 30 meter resolution raster elevation grid, and Shasta, a 30m DEM in northern California. All data are in NAD83 UTM coordinates, Z units in meters, the Minnesota files in zone 15, and the California files in zone 11. What You’ll Produce: Three maps. First you’ll create a mosaic of the valley DEMs. Then you’ll fix the Shasta DEM, and produce a hillshade map. Then you’ll create the second map, a cost surface with an applied threshold, and a third map, some of the intermediate data used for the cost surface. Project 1: DEM Combination, and 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. (Video: Resample)

Upload: others

Post on 21-Sep-2020

61 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

1

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 \L10 subdirectory, including Valley3 and Valley9, three and 9 meter DEMS of a portion of southeastern Minnesota, mar_rd83.shp, a vector road layer, and mardem, a 30 meter resolution raster elevation grid, and Shasta, a 30m DEM in northern California. All data are in NAD83 UTM coordinates, Z units in meters, the Minnesota files in zone 15, and the California files in zone 11. What You’ll Produce: Three maps. First you’ll create a mosaic of the valley DEMs. Then you’ll fix the Shasta DEM, and produce a hillshade map. Then you’ll create the second map, a cost surface with an applied threshold, and a third map, some of the intermediate data used for the cost surface. Project 1: DEM Combination, and 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. (Video: Resample)

Page 2: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

2

Start ArcMap and add both DEM data sets. Calculate the hillshade for both data sets (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. 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. Use ArcToolBox –> 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 ( Properties -> Source).

Page 3: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

3

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. Using the Raster calculator, we can nest these functions: ArcToolBox à Spatial Analyst Tools à Map Algebra à Raster Calculator Con(IsNull("valley3"),"valley9to_3","valley3") Name the output combinedDEM (Video: Raster Calculator) Remember to ALWAYS use your mouse to select the layers and operators in the Raster Calculator. Only use the keyboard to build the expression when you have no other choice. The Raster Calculator is a rather rigid parser. Typing formulas from the keyboard is prone to extra spaces and other minor syntax errors that will keep your expression from executing.

Page 4: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

4

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 Data Frame, and remove the Data Frame that contains the valley data. 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 hillshad 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 with the ArcToolBox –> Spatial Analyst Tools –>Neighborhood –> Filter command. Specify the Shasta DEM as the input, and a filter type of LOW, and specify an output name, like lowpass. Run the filter, calculate a hillshade for this new layer, and inspect the output, looking at the areas that have spikes and pits. The figure below left and right, corresponding the area above, shows the reduction in the size of the spikes and pits, although they are still visible.

Page 5: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

5

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 layer from the original Shasta layer. ArcToolBoxàSpatial Analyst ToolsàMap AlgebraàRaster Calculator Select the following in the Raster Calculator "shasta" - "lowpass" Name the output difference. The figure at right shows the calculation, with the largest differences at and around the spikes and pits. We can 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 Spatial Analystà Raster Calculator, and apply the following function, also shown within the raster calculator in the figure following: Con(Abs(“difference”) > 15, “lowpass”,”shasta”)

Page 6: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

6

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 smoothed.

We can verify that this is helpful by viewing the hillshade of the output raster, and comparing it to the original, and the filtered surfaces. Note that we have removed much of the speckle, but maintained the detail. 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. Calculate a hillshade of the smoothed raster, name it HillSmooth. Use an altitude of 25 degrees and model shadows.

Page 7: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

7

Add the shaded relief (that is the HillSmooth), making it semi-transparent (50%) over the smoothed elevation data. 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 map 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 elevation symbology stretch type set to Standard Deviations, n=2)

Page 8: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

8

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 model 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 - ArcMAP

• Create a new map project, add the raster DuluthSlopePercent to the view, and inspect it.

Use the cursor and the 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 ArcToolboxàSpatial Analyst ToolsàMap

AlgebraàRaster Calculator

• Use the mouse to select the equation Exp(“DuluthSlopePercent” * 0.2) as shown in the window below:

Page 9: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

9

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 We need to shave off the highest end, as it can cause functions to calculate too large a values later on. We want to get rid of any values over 300. We use the Con function, 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)

Page 10: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

10

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 below, we can derive a slopecost raster via “slope_exp300” * 1000 – 1000. Why the final -1000 at the end of the formula?

Page 11: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

11

Assign the following symbology and compare to the 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.

Page 12: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

12

Now calculate the distance surface, via ArcToolboxàSpatial Analyst ToolsàDistance àEuclidean Distance.

• Use DuluthNorthRoads as the input

• Name the output raster distance. • Set the cell size to 3

You should get something that looks like this figure:

Page 13: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

13

Calculate distance cost, as $25 per meter:

Now add the distance and slope costs:

Page 14: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

14

We now introduce a 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 values between 0 and 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 Reclassify for instructions on how to use the Reclassify tool Start the tool by ArcToolboxàSpatial Analyst ToolsàReclassàReclassify.

Page 15: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

15

In the reclassification window (not shown), set the − Use totcost as your input layer, − Delete entries so that you have two numeric rows, and one that maintains

NoData − 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, 345425, but any number larger than that as an ending value will work.

− Assigns NoData to NoData − Place the output in a raster named classmask

This should result in a reclassification table as shown below:

Click O.K. to execute the function

Page 16: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

16

This should result in a mask layer: Use the raster calculator to multiply the mask by the total cost layer (instructions not shown, refer to earlier parts if you’re unsure how); call the output something like Final_Cost. It should look something like this: Create a pdf of the map. Create a composite layout with four separate data frames on the same layout, with 1) a data frame with the distance cost layer, 2) another data frame with the slope_costs layer, a data frame with the mask layer, and 4) a data frame with the total cost layer. Add the roads layer to each data frame. Use a contrasting color for the mask, and

Page 17: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

17

color the distance and slopes costs and the final cost as graduated colors, uniform color set. Include the appropriate legend for the map, with a title, name, north arrow, legend, and scalebar Note that you should make all of the data frames the same size in the layout view. You can do this by right clicking on a frame, and then selecting Properties – Size and Position and set the width and height to something appropriate, here 4 inches each: (Video: Sizing and Aligning Panels) Note that get a uniform size for each layer, we need to: • Activate each data frame in turn (right click on TOC then Activate) • right click on the displayed layer, and select Zoom to layer

Page 18: Lab 10: Raster Analyses - GIS Courses...GIS Fundamentals Lab10: Introduction to Raster Analysis 3 We can now combine the two data sets. Although there are many ways to do this, perhaps

GIS Fundamentals Lab10: Introduction to Raster Analysis

18

You should turn in a map that looks something like: