Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Numberedheadings
number-formatdecimal
skip-headingsh3H3, h4HNaN
h1[h1.decimal].
start-numbering-with53
h2[h1.decimal].[h2.upper-latin]
h3
h4
h5
enabledtrue
h6
start-numbering-atH1

QGIS Raster Analysis

Introduction

Raster data is a wide field of analysis, so in these exercises we will introduce some common techniques and tools, and work with some specialist raster processing plugins, using UK Environment Agency LIDAR data as our example.

This exercise follows on from the raster exercise in QGIS Essentials, so if you have your earlier project saved you can skip to the Aspect, Slope and Raster Calculations heading - if not carry on from here.

Open Raster Data

  1. Open the project ...\Advanced\Rasteranalysis.qgz

  2. Add the following raster image:
    ...Data\raster\EA_1m_DTM\lulworth_cove_dtm.tif

  3. You will see that the default styling uses the pixel values which represent height to show higher ground in white and lower in black - you can use the Identify Features tool to get values for individual pixels

  4. Go to Layer > Properties > Symbology and under the Band rendering section set the values as follows if they aren't set already:

    1. Set the Render type to Singleband gray

    2. Set Contrast enhancement to Stretch to MinMax  

    3. Set the Accuracy under Load min / max values to Actual (slower)

  5. Click OK.

The result will look like the image below - a LIDAR image of Lulworth cove.

Hillshading

  1. Use the Hillshade process to create a hillshade visualisation of the data, simulating the effect of sunlight

  2. Add the QuickMapServices OSM Standard layer above the hillshade layer

  3. Set Symbology > Color Rendering > Blending mode  to Overlay to see the hillshade layer through the OSM layer - you should now be seeing something like this:

Aspect, Slope and Raster calculations

The next exercise includes several parts, using different tools to analyse the land surface by slope and aspect.

You need to identify areas that:

  • have a south-facing aspect

  • have a slope of less than 3 degrees.

Create Aspect image

First determine the aspect.

  1. Select  Raster > Analysis > Aspect

  2. Set the Elevation layer to lulworth_cove_dtm and click Run

The image will be created and loaded with a singleband grey, style looking similar to this:

Examine the image, and change the Style settings to experiment with different visualisations. Using the Identify tool, click locations in the image to identify the pixel values - note that each value is in degrees between 0 to 360, indicating the aspect of the slope.

For more information about the range of pixel values, go to the Properties for the layer and click the Histogram tab.

Leave the aspect layer for now - you will make use of it after the next section.

Create Slope image

To determine the degree of slope across the terrain:

  1. Select Raster > Analysis > Slope

  2. Set the Elevation layer to lulworth_cove_dtm and click Run

The image will be created and loaded with singleband grey style, looking similar to the following:

  1. Examine the image, and change the Symbology settings to experiment with different visualisations

  2. Use the Identify tool and click locations in the image to identify the pixel values - note each value is in degrees indicating the steepness of the slope

  3. As with the previous image, check the histogram to get an understanding of the type of terrain in the area.

Raster Calculations

Having created the images for slope and aspect, you are going to perform three calculations using the raster calculator which will identify pixel values and hence areas that meet your selection criteria.

The first will identity all areas where the aspect is south facing - for this you are looking for aspects that range from 135 degrees to 225 degrees.

  1. Go to Raster > Raster Calculator

  2. Create the expression below using your own aspect layer names in the expression box

  3. Set an output file name for the raster (don’t check Create on-the-fly…)

  4. Click OK

  5. The image should be created and loaded as a grey rectangle

  6. Examine the image on the map - the values used are a Boolean dataset, with 1 representing areas that meet your criteria

  7. Repeat the same steps for slope, using the following formula with your layer name, to determine slope less than three degrees, saving the layer as slope_3.tif:
    slope@1 < 3

  8. You can now use the 1 and 0 values in both layers to calculate the area that meets both criteria

  9. Open the raster calculator, and this time use the formula (with your layer names) as follows:
    aspect_south@1 = 1 AND slope_3@1 = 1

  10. Set Color ramp settings on the resulting layer (if necessary) and view the results - this should now indicate which pixels in the image meet both the slope and aspect criteria you have specified

...