Lab Instruction
Lab 8 - Raster / Vector Analysis
Originally provided by Dr. Gopal
Due: 5pm, April 10th , 2013
Lab Overview
In previous labs we have learned some basic tools for processing and analyzing on vector data. However, another data type, raster data, is also essential in GIS studies. In this lab we will learn how to solve a real science problem by analyzing a set of raster data.
So in this exercise, we are going to study the likely areas of snail habitat using raster analysis. We will ultimately create a raster displaying impacted snail habitat and define its habitat based on elevation, vegetation cover and rock type. We will compare raster analysis results with vector analysis results
Lab Objectives
· Review the basic concept and characteristics of raster data
· Explore the difference between raster data and vector data
· Learn how to perform basic raster calculation in ArcGIS
· Learn how to create buffer zone in ArcGIS
· Learn how to solve problems, adjust layouts and produce maps using raster & vector datasets
Background
Raster Data
In its simplest form, a raster consists of a matrix of cells (or pixels) organized into rows and columns (or a grid) where each cell contains a value representing information, such as temperature. Raster data sets usually come from digital aerial photographs, imagery from satellites, digital pictures, or even scanned maps.
Rigid Ambersnail
A bean-sized snail, called rigid ambersnail, found in the Black Hills, South Dakota, is being studied for possible protection under the Endangered Species Act in the 1990s, which could restrict or prohibit human activity that threatens the snail’s survival.
Step-by-step Instruction
1. Download “Lab_8_Data.zip” to your local drive. (The file is located on the S drive: S:\eeos_623_sp2013\Lab_8, and the class wiki: http://eeos623-s13-pahlevan.wikispaces.umb.edu/wiki/changes) Open and extract all the files into one folder for this lab.
2. Launch ArcCatalog and navigate to the folder where your data is downloaded. Have a look at the data, you will find there are four data sets which will be used in today’s lab: Geology, Vegetation, Elevation and Roads.
3. Now you can terminate ArcCatalog and open the MXD file from the data you downloaded (Sample.mxd). The file should be opened in ArcMap. You probably will get a blank display.
4. You may notice a small red exclamation mark on the right of the check box of each layer in the “Table Of Content” area. This means the source of data is not correct which means ArcMap cannot find the correct data in the directory. This is because the directory where I put the data is different from yours. There are two ways to solve this issue (This is the last time I will discuss this issue):
a) You can turn off and turn on the layer and ArcMap will ask you to locate the data for it.
b) Or you can right click on the layer and select [Properties] and click [Set Data Source] under the [Source] tag.
5. Either way, a window will pop-up. Now locate the proper files on your local drive. In that window, navigate to the directory where you put all the data and select the proper files. It has to be noted here that each layer is a file geodatabase which contains multiple data types. When you are locating the data source for ArcMap, make sure to select the correct data. For Vegetaion and Geology, select the “Polygon” layer under the corresponding data set. For Roads, please select “Arc”. And for “Elevation” select the raster data called “dem”. In most of the cases you probably will only have to locate one file for ArcMap and it will automatically match the rest as long as you keep all the files in the same folder as I do.
6. Now you have successfully loaded all the data into ArcMap. Take some time to explore each layer and see what it contains and presents. If you have any trouble reaching this step, please to not hesitate to ask for help. The map should look like the following.
7. We will be using some spatial analysis tools in ArcMap today. The first step before we proceed is to add the required extension. On the top [Menu Bar], select [Customize] -> [Extensions…].
8. The extension we need for this lab is “Spatial Analyst”, but you can check every choice. Click [Close] after you finished.
9. Now the snail prefers areas with a elevation range of 1200 - 1600, so the first step will be to identify raster cells between 1200 - 1600 meters by performing a Boolean Overlay Analysis. You can choose either Reclassify or Raster Calculator to perform this operation.
a. Reclassify Operator:
1). In ArcToolbox choose [Spatial Analyst Tools] -> [Reclass] -> [Reclassify].
2). Have a look at the “Reclassify” window. Select the “Elevation Raster” raster file and set a proper output location first. In the “Output raster” field, navigate to the location where you saved the “Elevation Raster.” Name the new file “Reclass_dem”. Now in the Reclassification area, you will have to set up 4 entries as shown in the figure below. You can select each entry by clicking on the gray square located on the left side of each entry. Multiple-selection is available by holding <Shift>. After you have completed the inputs as shown in the figure below, click [OK] to proceed. Be aware that spaces are required at both side of the “-“ sign.
3). When the process is done, a balloon will pop up in the left button corner. A new layer will be added into your map as shown in the following figure. If there is an error, please try again or ask me for help.
b. Raster Calculator:
Optional, learn an alternative.
If you completed the above steps with “Reclassify” then you don't have to do the following operation. But if you would like to learn another tool, fell free to complete the following. Just remember to save it as another file name and only choose one to use in later steps of this lab.
2). In the ArcToolbox select [Spatial Analyst Tools] -> [Map Algebra] -> [Raster Calculator].
3). Enter the proper inputs as the following figure. Choose the proper output location and file name then click [OK]. The correct expression should be the following:
("Elevation Raster" >= 1200) & ("Elevation Raster" <= 1600)
4). You are supposed to get a raster data showing the area where the snail prefers to live. The result should look like the following figure.
10. Now let’s keep moving. The next step is to select the area of certain rock type that the snail prefers. We will do so by using the “Select by Attributes” tool. On the top “Menu Bar”, click [Selection] -> [Select by Attributes…].
11. In the “Select by Attributes” window first select “Geology” as the input layer. The fields of the layer will be shown in the first list box. Click on the term “NAME” and then click [Get Unique Values]. You will see that all the possible values that the field “NAME” has will be shown in the second list box. Now we need to construct an expression to tell the computer what to select. You don’t really have to type in the following expression.
"NAME" = 'Madison Limestone' OR "NAME" = 'Upper Paleozoic'
In fact you can construct the expression by double clicking the terms in the two list boxes and single clicking the buttons. The corresponding term will be added into your expression automatically. For example you can double click on [“Madison Limestone”] to add this term into your expression. This way you will not be bothered by typos. Your window should look like the following figure. Click [ok] after this step.
12. If “Geology” layer is activated, you will be able to see that some of the area is selected, which is highlighted with cyan boundary.
13. Since our final analysis will be in the raster format, we need to convert the features to raster using Spatial Analyst Tools. In the ArcToolbox select [Conversion Tools] -> [To Raster] -> [Feature to Raster].
14. In the “Feature to Raster” window, select the layer “Geology” as the “Input features”. Select “Unit” as the “Field” which is a numeric representation of the rock type. Set the proper output direction and file name. In this case I named it as “Geology_Selected”. The “Output cell size” should be set to 50. If your inputs are the same as the following figure, please click [ok] and let ArcMap to finish the process.
15. After the conversion is finished you will see a new raster layer which has two values, 5 and 7, corresponding to the two rock type. If your number is different, you might have selected the wrong rock type or the wrong input field. Please check again and redo the process.
16. Now we need to create another Boolean layer for the Geology layer just as we did for the DEM. You can either repeat the “Reclassify” or “Raster Calculator” procedure on the newly created “Geology_Selected” layer, which is the one with the only two rock type we just converted. Set the two rock type value (5 and 7) into 1 and the rest as “NoData” and save it as “Geology_Bool”. This step is a repeat of the previous step so I did not enclose detail steps. Please refer back to earlier section of this lab, but be aware to choose set the right inputs and parameters. You should get a layer that looks like the following figure. If you have any question, feel free to ask your neighbor or me.
17. So far we have learned how to select feature by their attributes, convert them into raster file and then reclassify them into Boolean representation. Here is a little practice we can do without the step-by-step instruction. Now please use the appropriate methods we learned above to create a Boolean Raster layer for the Vegetation layer. Here are some hints. First, select COV_TYPE = ‘TPP’ AND DENSITY96 = ‘C’ from the “Vegetation” layer. Then convert it to raster format, just choose “COV_TYPE” as the “Field” and 50 as the “Output cell size”. In this case, since there is only one tree type which is selected, so there is no need to reclassify the data, it is already in Boolean. Make sure that the direction and file name of the output of each step is named properly so that you can always understand which layer you are using. In this lab, I will name the final output as “Vegetation_Bool”. You should be able to get a new raster layer that looks like the following figure. If you have any question, feel free to ask me anytime.
18. Now we need to combine the three layers we just created using “Map Overlay” in raster. Before we start, make sure we have three raster data containing NoData and 1’s. If we multiply these grids together, for each cell that contains 1 in each input grid, the output grid will contain 1 in the corresponding cell when all three conditions – Elevation, Geology and Vegetation are met. Any cell that does not fulfill any one of the constraints will have a value of 0.
19. We can use “Raster Calculator” to perform the final output. In ArcToolbox, select [Spatial Analyst Tools] -> [Map Algebra] -> [Raster Calculator]. Enter the following expression.
"Reclass_dem" * "Geology_Bool" * "Vegetation_Bool"
Set the proper directory and file name. I will use “Snail_Habitat” here.
20. The result should look like the following figure. If it does not, then please recheck your steps and try again.
21. The final step is to identify primitive road sections crossed by snail habitat. Since road layer does not transfer well into 50 meters raster cells, we need to convert our snail habitat raster into vector to overlay with vector roads. In ArcToolbox, select [Conversion Tools] -> [From Raster] -> [Raster to Polygon].
22. In the “Raster to Polygon” window, select the newly created “Snail_Habitat” as input raster. Select “Value” as “Field” and set a proper direction and file name. I will use “Snail_Hab_Vec” here. Leave the “Simplify polygons” checked as default. Click [ok] after you settle all the inputs.
23. Now select the Roads by attributes, select all road with “TYPE” = ‘PR’. Just as we did before, on the top “Menu Bar”, select [Selection] -> [Select by Attributes…]. Select “Roads” as input layer and set the expression as <”TYPE” = ‘PR’>. Your result should look like the following figure.
24. Then in ArcToolbox, select [Analysis Tools] -> [Overlay] -> [Intersect]. Select “Roads” and “Snail_Hab_Vec” as “Input Feature” and set a proper output direction and file name. This will create a layer with all the primitive roads that intersects snail habitat area. Your results should look like the following figure.
25. A last research question is the following: How many snail habitat areas are within 200m distance from any primary and secondary roads? In order to accomplish the task, we need to know how to create a buffer.
26. Remember we are still selecting the primitive roads in the “Roads” layer. The first thing we need to do is create a new selection to select “Primary” and “Secondary” roads. Again, on the top menu bar, select [Selection] -> [Select by Attributes…]. Use “Roads” as input layer, and make sure the method is “Create a new selection”. Here we want to select all features with “TYPE” = ‘P’ OR “TYPE” = ‘S’. Your window should look like the following figure. And then please click [ok].