Related Plugins and Tags

QGIS Planet

Combining Raster Calculator with elevations

I want to identify which areas of Chetney Marshes would be flooded by a 2m rise in sea level.  I used LIDAR data in contour format as the elevation data:-

Chetney Marshes map

Chetney Marshes map

Create TIN

I am using the TIN method to create an elevation model as the area is relatively small and the data is supplied as contours. TIN’s are more accurate, especially if the source data isn’t in grid format. However they are slower to process, especially over very large areas.

Select Plugins, Interpolation to open the Interpolation dialogue:-

Raster Calc2

I made the following changes to the display properties:-

  • Colour map – Pusedocolour
  • Transparency – I set global transparency to 50%
Chetney Marsh after colour adjustment

Chetney Marsh after colour adjustment

Raster Calculator

I now have an elevation model of the area. I now use the Raster Calculator to identify each pixel with an elevation of less than 2m. The elevation is stored in the pixel value. The raster calculator will identify each pixel with band value of less than 2.

The expression is elevation < 2

Select Raster, Raster Calculator to open the Raster Calculator:-

Raster Calc4

To change the Display Properties for a layer, Right click on the Layer in the layers panel (Table of Contents) and select Properties. I made the following changes to the display properties so the areas that are less than 2m, and susceptible to flooding appear highlighted in blue:-

  • Style tab: Color map – Colormap
  • Transparency: Global transparency 50%
  • Colormap tab: I added 2 entries:-
    • 0.00 white
    • 1.00 blue
Chetney Marsh showing raster calculation results

Chetney Marsh showing raster calculation results

 


Raster Data Extraction using QIS

Raster files consist of a grid of cells, each cell contains a numeric value, which is used to determine how to colour each cell.  This value may be based on the elevation of the cell, flood water depth, or soil quality. It is possible to extract this information by point sampling or using a terrain profile. Point sampling copies the cell’s value to the overlying point. A terrain profile tool plots a graph with the cell’s value (elevation) on the Y axis and the distance along the section on the X axis.

Point Sampling Tool

DEM’s are often used to then update the elevation values of overlying points, for example I have used data from DEM’s to update the elevation values of address points and utilities. This isn’t as accurate as surveying each point, but it is a lot quicker! This process is also referred to image extraction, raster/vector conversion.

For this tutorial, you will need:-

  • The Point Sampling tool in QGIS is an optional plugin. You can download it by using the menus to select Plugins, Fetch Python Plugins.
  • Nasa’s srtm data, which you can download from here: http://srtm.csi.cgiar.org/
  • Some point data. If you can’t think of any, then they’re easy to create, for example use the Open Layers plugin to load Open Streetmap or Google Maps of your area, and then create points over a few cities.

I’m going to add the elevation value from the srtm rasters to a selection of UK towns and cities:-

Raster Data Extraction - UK srtm

  1. Use the menus to select Plugins, Analyses, Point Sampling Tool
  2. The Point Sampling Tool dialogue box opens. Select:-
  • The layer that contains the points to be sampled
  • The layer(s) with the field(s)/band(s) to get values from
  • The output (results) file
  • Press OK

Raster Data Extraction - Point sampling tool

The results file just contains the elevations:-

Raster Data Extraction - Elevations

It is possible to add these to the original layer:-

  • Create a buffer around the new points
  • Use the menus to select Vector, Data Management Tools, Join Attributes By location
  • Select the original points as the target and the buffer as the join layer

Another option is to update the x and y co-ordinates for both points using the Field calculator and then to match the rows in Excel on the co-ordinate column.


Raster Based Terrain Analysis Techniques pt2

Continuing from last week’s post, I will show you how to use terrain analysis to calculate:-

  • slope,
  • aspect
  • hillshade
  • ruggedness index

Slope

Slope is calculated by comparing the pixel value at a particular location relative to the surrounding 8 pixel values. This gives the steepness of the slope.

The Slope dialogue box is very simple:-

Calculate slope dialogue box

Calculate slope dialogue box

  • Select the elevation layer (this will be the DTM raster)
  • Select the output layer
  • I have left the Ouput format and Z factor as default. If the ground is very flat, then exaggerating the z factor might make the slopes easier to visualise.

Aspect

The aspect shows the compass bearing of the slope

The raster has been given values from 0-360 depending on the slope aspect. The darker areas with the lower values are the north to north east facing slopes; the lightest areas with the highest values are the west to north west facing slopes.

Aspect shading

Aspect shading

Hillshade

This calculates the amount of sun or shade for a 3D surface. The dialogue box is similar to the previous ones, however there are new options for the sun angle:-

DEM hillshade dialogue box

DEM hillshade dialogue box

This analysis uses a fixed location of the sun to accurately simulate the effects of bare hillside and shaded valleys. I positioned the sun to the south west (200 degrees), the east facing slopes around the River Medina estuary in the north of the island are very shaded, in contrast to the brightly lit west facing slopes on the other side of the river.

A DEM with hillshading

A DEM with hillshading

This is the most visually appealing and easily understood result and so it is often used as a backdrop for maps with other layers added.

Ruggedness Index

The ruggedness index value is calculated for every location, by summarizing the change in elevation within the 3×3 pixel grid.  Ruggedness index values are grouped into categories to describe the different types of terrain.  The classifications are as follows:

Ruggedness Classification

Ruggedness Index Value

Level 0 – 80m
Nearly Level 81 – 116m
Slightly Rugged 117 – 161m
Intermediately Rugged 162 – 239m
Moderately Rugged 240 – 497m
Highly Rugged 498 – 958m
Extremely Rugged 959 – 4397m

The dialogue box for the ruggedness Index is the same as it is for the other types of analysis mentioned above. The IOW is all categorized as level or nearly level in the ruggedness index. This is despite it being quite hilly! I used the Stretch to MinMx contrast enhancement on the layer properties box:-

A DEM with ruggedness index displayed

A DEM with ruggedness index displayed

The result is quite different to the relief and hill shade raster’s. This is because, it doesn’t attempt to show actual slopes, rather it shows the change in elevation categorised as shown in the ruggedness index table. It is still easy to see the line of hills that cross east to west across the island.


Raster Based Terrain Analysis Techniques pt1

In the previous tutorial, I showed you how to create a raster terrain model. This is useful by itself for visualising the relief of an area. However, it can be even more useful when used as the basis of further analysis.

Over the next few tutorials, I will show you how to carry out the following types of analysis:-

  • Slope
  • Aspect
  • Hillshade
  • Ruggedness Index

I am going to use srtm data for the UK, you can download the file for your area from here: http://srtm.csi.cgiar.org/

Displaying the raster, resolving display problems

  • Add the image to the project using the Add Raster Layer button. At first the image opens completely grey, to stretch the black to white gradient to fit between the minimum and maximum values found in the image:-
  • Press the Stretch Histogram to Full Data Set on the Raster toolbar
  • Alternatively, right click on the layer in the Layer Panel, and
    • Select Properties.
    • Select the Style tab.

    At the bottom, change the Contrast Enhancement pull down to Stretch to Min Max.

  • If a grid displays as a continuous grey box, check the Transparency for null cells setting
    • Open the Layer Properties
    • Select the Transparency tab

      QGIS Layer Properties

      QGIS Layer Properties

  • Check that the correct band is selected in the Transparency Band pull down
  • Check the No data value and Percent Transparent entries in the Transparent Pixel list

The DEM Models plugin should appear on the Raster Menu. If it isn’t installed, it can be downloaded by using the menu to select Plugins, fetch Python plugins.

Its operation is similar for all the types of analysis that can be undertaken

  1. Select the input raster layer
  2. Select the output raster layer that will contain the results
  3. Use the pull down to select the analysis:
  • Hillshade
  • Slope
  • Aspect
  • Color Relief
  • Terrain Ruggedness Index
  • Topographic Position Index
  • Roughness
DEM Terrain Module

DEM Terrain Module


Image Analysis Using QGIS

Introduction

Rasters are created from gridded data. Each pixel is coloured according to an interpolated value, e.g. triangulation (TIN), nearest neighbour analysis.

A raster file is comprised of a pixels arranged in a grid formation. Each pixel contains a colour value that instructs the computer as to what colour to use when displaying it. Raster images tend to be used for grids as they are a more efficient method of showing large areas of coloured pixels than vector maps.

The following illustrates how a raster grid represents terrain, and how the information might be extracted:-

For simplicity’s sake, imagine that we’re back in the days of 256 colours with 1 being white and 255 being black. I tend to display relief with the highest ground as white or red, then to show lower ground as green or blue.

Let’s take a cross section through a hill:

A grid raster image of the terrain would appear similar to below (please note that I have drawn this in Inkscape using a gradient fill to keep the demonstration simple!):-

The numeric values of the raster grid that the computer would see would be similar to this:

5 5 5 5 5
5 100 150 100 5
5 100 250 100 5
5 100 150 100 5
5 5 5 5 5

Note the values are not the actual elevation, just the colour values of the pixels. The elevation that each pixel value corresponds to (the legend) is contained in the accompanying shape file along with image registration (the x, y coordinates).

By analysing the grid and determining the relationship between pixel values and the elevation that they represent the GIS software can accurately model the terrain. Once the terrain has been modelled, it is possible to undertake further analysis such as slope calculation, predicting hill shade or water runoff.

The Image toolbar

Firstly, let’s have a look at QGIS’ image tool bar:-

QGIS image bar

QGIS image bar

This can be added by right clicking on any toolbar and selecting Raster from the short cut menu. The buttons are from left to right:-

  • Stretch Histogram to Full Data Set
  • Local Histogram Stretch
  • Geo-referencer
  • Interpolation
  • Zonal Statistics

  • Page 1 of 1 ( 5 posts )
  • terrain analysis

Back to Top

Sustaining Members