0% found this document useful (0 votes)
12 views

Prac 8

Uploaded by

userlaud
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)
12 views

Prac 8

Uploaded by

userlaud
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/ 11

Geographic Information Systems 707/805

Practical Session 8 - Raster GIS

Introduction
The software we are using, ArcGIS, is capable of working in both raster and vector
modes. It has an extension for the processing of raster data called Spatial Analyst.
Students should have installed and licensed that extension when installing the rest of
the software. Information about accessing that extension is included in this practical
sheet.

Before beginning this week’s exercise, we will first get our data and connect to it in
ArcMap or ArcCatalog. Download the file prac8.zip from Blackboard and then unzip
the file into your D: drive, or whatever you use (make a new folder called GISprac8
first), remembering to tick the option "Use Folder Names". This will ensure that the
required subdirectories will be added automatically as the data files are unpacked.

Note that the files should be saved directly onto your D: drive. If you do end up
having to save to a different drive and/or folder, make sure that no folder in the path
contains any spaces. The folder that is unzipped (data8) is your working directory for
this practical.

The data used in this week is from an area on the border between Mauritania and
Senegal and is from one of the Exercise data sets distributed with the IDRISI GIS
software. The two data layers are relief (elevation) and a soil map.

Open ArcMap and connect to the gisprac8/data8 folder using ArcCatalog and find the
Mauritania Geodatabase. Open it to see its contents. The two datasets inside the
Geodatabase have their own special icon which is intended to show that they are raster
(cell based) datasets. You have in fact seen this icon before, since the topographic map
and sketch map that we have worked with in previous practical sessions were rasters. If
you are connecting from ArcMap to data8 folder using ArcCatalog then you may have
different screen version than that of connecting from ArcCatalog directly. For your
convenience, I have pasted both versions below.

Connecting from ArcMap Connecting from ArcCatalog

Click on the drelief icon shown in the branch structure in the left panel, then in the
right panel click on the preview page in ArcCatalog. (Note: to view in the ArcMap,

1
you need to drag and drop drelief in the TOC from the right-hand side in the Catalog
tree). What is shown?

We have previously been working mostly with vector data. ArcGIS calls vector data
layers feature classes. In ArcGIS, the raster data are simply called raster datasets.

Exercise 1 - Displaying Raster data in ArcMap


Start ArcMap and use the Add Data button to add the drelief dataset from the
Mauritania Geodatabase in your working directory (alternatively to view in the
ArcMap, you need to drag and drop drelief in the TOC from the right-hand side in the
Catalog tree). It will say that one or more layers are missing spatial reference
information, however for this practical session it will be OK to continue.

Now save your ArcMap project onto your D:\gisprac8 folder as Mauritania.mxd by
selecting File > Save As...from the menu.

As with vector data, map information, layer and legend information, and menu and icon
bars will be displayed. For raster data, layering will cause the different raster images to
be displayed one on top of another. Turning on and off the different layers easily allows
you to switch views between different raster layers and/or hide types of vector data
which can also be displayed in the same map view

Use the Identify tool to query the attributes of the feature that you click on. In this
case as we are looking at a relief (elevation) map so the cell value represents the height
above mean sea level in metres for the cell you just clicked on. Experiment with
different areas and compare the shade and height of the pixel value with the value in
the map legend. Notice that two values are reported to you. One is the actual value
attached to the cell, the other is the "stretched" value used for display.

Raster data symbology is slightly different from vector symbology, particularly for
continuous "field" data.

Let us experiment with changing the colours shown on the map. The default colour for
the raster image is black and white which looks a little boring. Right click on the drelief
layer in the TOC window then select Properties. You will be presented with the Layer
Properties window. Click the Symbology tab and experiment with different colour
ramps. Notice the "invert" box at the bottom of the window.

2
Once you are happy with your map colours for the drelief layer, we will load soil data
into ArcMap as well. Use the Add Data button to add the dsoils dataset from the
Mauritania Geodatabase in your working directory. It should load with a classified
coloured scheme. Use the information tool ( ) to explore the values of the different
classes. Note that one of them is called NoData and is symbolised as transparent. This
is how ArcGIS handles areas within a raster which do not have data associated with
them. Remember that ALL cells in a raster must have some value, ArcGIS assigns a
special value so that this condition is adhered to.

Now that you have both the soils map and the relief map loaded in ArcMap, try turning
on and off the two layers by checking and un-checking the boxes beside layer labels on
the left. You can also order the layers by clicking and dragging one above the other.
Explore and compare the different datasets. Notice how the soils change with the height
of the terrain?

Can we improve on this display? Yes, of course. Place the drelief layer on top and right-
click on its name in the TOC to bring up the menu. Select Properties and then the
Display tab. Notice that there is a window named Transparency. Try a few values in
here. Is that making it easier to look at the two data layers together? Try it the other way
with the dsoils layer on top and transparent. You may find that having one of the layers
displayed in shades of grey helps.

Now let us look at the attributes of our two layers. Open the attribute table of the dsoils
layer (right-click the name to bring up the context menu). Notice that there are only 3
columns apart from OID. The two that are important are Value and Count. Try to open
the Attribute table for drelief. Can’t do it? Can you think why?

3
The drelief dataset is made up of real (or floating point) data. That is data with a decimal
point in it. This means that there is potentially a separate Value entry for each cell in the
raster!

How many cells are there in these rasters anyway? Open the layer properties window
for each of the layers in turn and examine the information stored under the Source tab.
Write down the number of rows and columns in the rasters and the type of data
compression.

Now return you symbology for both layers to No Transparency and Save your
ArcMap project before proceeding to the next exercise.

Exercise 2 - The Spatial Analyst extension


Spatial Analyst is an extension to ArcGIS. Extensions need to be turned on before
being used. Follow these steps to make sure you have it ready for use.

1. From the menu, click Customise>Toolbars>Spatial Analyst and make sure


the Spatial Analyst box is ticked. o This will make the Spatial Analyst
toolbar active.
2. If the toolbar is 'floating' over your workspace, you can 'dock' it with the other
toolbars by dragging it (not from a button!) into the correct position.
3. Note the following details on the toolbar. You will be using them in the
following exercises.
Histogram tool

Active layer Contour tool


window

a) Contouring a surface

Because our drelief layer is a continuous surface, we can make a contour representation
of it. There are two ways of doing this. One draws contour lines that are at the same
height as point we chose on the map. The other creates a complete set of contour from
the lowest to highest values in the dataset.

Make sure that the drelief layer is chosen in the Active layer window, and is the top
layer in the TOC. Then click the Contour button and then click a location on the map.
This tool runs a contour round the surface from any chosen point. To delete a contour,
from the Tools toolbar, click the Select Elements tool , then click the contour line
you want to delete, then right-click the contour line and finally click Delete on the
popup menu ( Note: you can also use the Delete key). These contours have been created
as Graphic Elements rather than as Geospatial data features. Use the ArcMap Help to
check out the differences.

4
Once you have deleted all the contours you have made, let's produce a set of contours
or the whole dataset. To create a contour map, you need to open ArcToolbox ( ).
Clicking on ArcToolbox will pop up a range of tools. Upon opening toolbox, expand
plus (+) sign of Spatial Analyst Tools, then expand Surface tools by clicking on the
plus (+) sign again. From Surface tools, choose Contour and fill the form look like the
below one. In the output features, save the contour as ‘Contour”.

A set of contours will be added to your map. Spatial Analyst has created the contours as
vector features - in this case a shapefile. They will all be black at first but you can
symbolise them and label them like any other vector data.

b) Histograms

Now make dsoils the Active layer and click on the Histogram tool on the Spatial Analyst
toolbar. You may get only one histogram at this stage. To show the frequency
distribution of the 5 classes of dsoils, you need to double-click on the legend item of
the histogram which will bring a form to fill manually. Choose dsoil from Layer/Table
dropdown menu and choose VALUE in the X label field. You will now able to show 5
frequency classes of dsoil. If you are fine go to Reclassification.

c) Reclassification

One of the basic things we are likely to need to do with raster dataset from time to time
reclassify them. Go to ArcToolbox>Spatial Analyst Tools>Reclass Tools. On the form
that appears set drelief as the Input Raster and then select Classify and modify the
Classification method and Number of classes as shown below.

5
Click OK on the Classification form and return to the Reclassify form. Fill that in as
below.

Click on the OK button and a new layer should be added to your map, with 5 classes
representing the elevation bands you chose in the Reclassify window. Do you think this
contains more or less information that the drelief layer? Right click on the layer name
and bring up the "Context menu". Select Properties and choose the Source Tab. Check
that the data has been written into your working directory. Now, go to ArcCatalog (or
swap to it if it is already open. Highlight your data7 directory in the

6
ArcCatalog TOC and click View>Refresh from the main menu. Then explore the
contents of the directory and the database. You can find that a new one created inside
the database.

Now that you remove all layers except drelief and dsoils and save your
Mauretania.mxd file.

Exercise 3 - Raster GIS analysis


a) The Problem

The area to the south of the river (inside the horseshoe-shaped bend) is in Senegal and
has not been digitised. As a result it has been given an arbitrary height of 10 metres.
Our analysis will focus on the Mauritanian side of the river. The area is subject to
flooding during the rainy season. As the area is normally dry, farmers practice
"recessional agriculture" by planting in flooded areas after the waters recede.

A project is being proposed to place a dam along the north bank at the northernmost
part of this bend in the river. The dam will be used to hold the waters in place for an
extended period of time. Our problem is to find all regions (and their areas in hectares)
that meet the following conditions:

1. Is within the normal flood zone; and


2. Has soil suitable for recessional agriculture

b) Determine the flood zone

First, we need to find all areas in the study area that fall within the normal flood zone.
Previous flood records indicate that a typical flood is around 8 metres. We first need to
isolate all areas with elevations of less than 8 metres and produce a new map layer
called flood.

GIS analysis often involves calculations involving "Boolean Algebra". To find out more
about Boolean algebra and how we can use it in our analysis in this Practical we will
explore the Help functions available in ArcGIS10. From the Main Menu, Select Help >
ArcGIS Desktop Help.

Once you have the help window open, select the Index tab on the left search panel and
type in "Boolean". We will only be using the Boolean AND today however look at the
OR, NOT and XOR tools as well. Boolean operators use Boolean logic (TRUE or

7
FALSE) on Input raster layers on a cell-by-cell basis. Output values of TRUE are
written as 1 and FALSE as 0. View the illustration about each of these tools and make
sure you understand what operation each one performs.

Now we are ready to proceed.

From the ArcToolbox>Spatial Analyst Tools, click Map Algebra by clicking the plus
(+) sign next to it and choose Raster Calculator. A pop up will be displayed where you
need to do the calculation. Notice the list of active layers available. You can build
commands by selecting layers, clicking the available buttons or typing in the box. We
will set values of the flood layer equal to TRUE (1) where the drelief layer is less than
8 m and all other values will be left as FALSE (0). Enter the following command to
reclassify the relief data to flood zones:

“drelief” < 8

Save the Output Layer as “flood” in your working folder. Press OK button and inspect
the resulting layer. Carefully compare this to your drelief layer. Does it look correct?
Make sure you set the layer classification to show unique data values so your legend
only shows values of 0 (non-flooded) and 1 (flooded).

c) Finding suitable soils


Now let us find all the suitable soils. This table Soil Description Soil Class
shows the types of soils and their classification as
seen on the map. Heavy clays 1
Clays 2
Sandy clays 3
Levee 4
Stony 5
Normal clay soils are the most suitable for
recessional agriculture. We want to isolate just normal clay soils for our analysis.
Display the dsoils layer in ArcMap and inspect the data to find areas of Clay soil. We
want to now reclassify this layer to use in our analysis. Once again, go to Raster
Calculator in Map Algebra tool in ArcToolbox, enter the following command to create
a new layer:

“dsoils” = = 2

Note the Calculator uses two = signs. This is because we are indicating equivalence
rather than equality. Call and save this new output layer is bestsoil. Inspect the resulting
image carefully and compare it to the dsoils layer. Does it look correct?

d) Overlaying flood areas and suitable soils

Now we want to find the regions that are within the flood area AND are have suitable
soils. This means that we need to overlay the two newly-created layers. Because there
are a number of different overlay operations, we need to consider which one is most

8
appropriate. Because we have chosen to use Boolean values to represent flood areas
and suitable soils, we can simply use a Boolean AND operation to obtain the areas
where both these two layers are shown as "TRUE". Once again using the Raster
Calculator in the Map Algebra tool and enter the following command:

“flood” AND “bestsoil”

If you built the expression by clicking on buttons it will appear as:

[flood] & [bestsoil]

Save this new layer as bestarea. Inspect the resulting raster carefully and compare it to
the bestsoil and flood layers. Does it look correct? You can use the identify tool to
examine the values at any cell for all layers in your TOC. Experiment with it.

e) Finding the area of the regions

At the moment, all our “best areas” have the same identifier of 1. We would like to find
the area of each of the regions shown. To do this, we need to group them together so
that where a number of cells with the same value touch each other, they have a new
unique identifier as a group. To do this we need to use the Region Group Tool.

Open the toolbox and choose Click ArcToolbox >Spatial Analyst Tools
>Generalisation > Region Group

When the form shown above appears fill it in as shown and click OK.

Why do you think we set the "Exclude" value to zero? What do you think would be the
effect of selecting the "Eight" options as the number of neighbours to use?

You should now have a raster layer called bestarea2. Use the Identify tool to click on
some of these areas. Among the information this returns you a value showing the

9
Unique ID and a Count of the number cells in each area. It would be much nicer to have
this information available as a table.

Using the ArcToolbox select Spatial Analysis Tools > Zonal > Zonal Statistics as
Table.

Use the dropdown boxes on the form to set the following parameters:

Input raster or feature zone data: bestarea2 Zone


field: Value
Input Value Raster: bestarea2
Output table: bestarea_stats (This should be inside your Mauritania Personal
Geodatabase). All other remains default.

Click OK.

Upon creation, the table will be automatically added to your ArcMap and the TOC will
be set to List by Source. The table should have been added to the bottom of the list.
Display it by right-clicking on the table name and selecting Open. The Zonal Statistics
tool has extracted the cell size from the raster data information and is now presenting
the areas in square metres.

Close the table and return the TOC to the "Display" tab.

f) Creating the final layer

We want to now create a map to use to display the best area for recessional agriculture
in relation to the other soil areas. This means we need to overlay our original bestarea
layer with our dsoils layer.

A simple Boolean AND overlay is not possible this time because we want to maintain
the soil classes which have already been classified. We will name our new bestarea soil
class as Class 6 since there are already 5 existing soil classes. We need to reclassify the
bestarea value so it will display as a unique value when viewed on the soils map. Then
we need to superimpose the reclassified bestarea map onto the soils map.

Firstly, to reclassify the bestarea layer, either use the Reclassify tool, building on your
previous experience with it, or use the following Raster Calculator command from the
Map Algebra tool:

(“bestarea” * 6)

Save this new layer as bestarea3. Whichever way you created it, this layer should have
the recession agricultural areas shown as a Value of 6 with all other areas as either Zero
or NoData.

The challenge now is to blend this in with the dsoil layer so that where the soil is suitable
for use for recessional agriculture, it shows as class 6 but elsewhere it shows as its

10
original class. There are several ways of doing this, the one we will use here is the Con
tool (short for conditional)

Open it from the ArcToolbox at Spatial Analyst> Conditional>Con


Fill in the form as shown below. (Read the main Help on this to fully understand what
is being done here).

The result should be a map with 6 classes, of which class six represent the areas suitable
for recessional agriculture. Check to make sure that it is indeed correct by referring to
your original data sources.

If you want to keep your work, save the .mxd and then backup your work as usual
since questions may appear in the next quiz!

END OF PRACTICAL 8

11

You might also like