RSGISLib Elevation Module

The elevation module contains functions for performing analysis on elevation data.

Slope and Aspect

rsgislib.elevation.slope(inputImage, outputImage, outAngleUnit, gdalformat)

Calculates a slope layer given an input elevation model.

Where:

  • inputImage is a string containing the name and path of the input DEM file.
  • outputImage is a string containing the name and path of the output file.
  • outAngleUnit is a string specifying the output unit (‘degrees’ or ‘radians’).
  • gdalformat is a string with the output image format for the GDAL driver.
rsgislib.elevation.aspect(inputImage, outputImage, gdalformat)

Calculates a aspect layer given an input elevation model

Where:

  • inputImage is a string containing the name and path of the input DEM file.
  • outputImage is a string containing the name and path of the output file.
  • gdalformat is a string with the output image format for the GDAL driver.
rsgislib.elevation.catagoriseAspect(inputImage, outputImage, gdalformat)

Creates an aspect layer which is categorised into 8 catergories from 0-45, 45-90, 90-135, 135-180, 180-225, 225-270, 270-315 and 315-360.

Where:

  • inputImage is a string containing the name and path of the input aspect (in degrees) file.
  • outputImage is a string containing the name and path of the output file.
  • gdalformat is a string with the output image format for the GDAL driver.

Flitering

rsgislib.elevation.dtmAspectMedianFilter(inputDTMImage, inputAspectImage, outputImage, aspectRange, winHSize, gdalformat)

Filter the DTM for noise using a median filter with an aspect restriction (i.e., only pixels within the aspect range of the centre pixel will be used within the median filter).

Where:

  • inputDTMImage is a string containing the name and path of the input DTM file.
  • inputAspectImage is a string containing the name and path of the input Aspect file (in degrees).
  • outputImage is a string containing the name and path of the output file.
  • aspectRange is a float with the range of from the centre pixel in degrees.
  • winHSize is an integer for half the window size.
  • gdalformat is a string with the output image format for the GDAL driver.
rsgislib.elevation.fillDEMSoilleGratin1994(inputDEMImage, validMaskImage, outputImage, gdalformat)

Filter the local minima in a DEM using the Soille and Gratin 1994 algorithm.

Soille, P., and Gratin, C. (1994). An efficient algorithm for drainage network extraction on DEMs. J. Visual Communication and Image Representation. 5(2). 181-189.

Where:

  • inputDEMImage is a string containing the name and path of the input DEM file.
  • validMaskImage is a string containing the name and path to a binary image specifying the valid data region (1 == valid)
  • outputImage is a string containing the name and path of the output file.
  • gdalformat is a string with the output image format for the GDAL driver.

Example:

import rsgislib.elevation
inputDEMImage = 'DEM.kea'
validMaskImage = 'ValidRegionMask.kea'
outFilledImage = 'DEM_filled.kea'
rsgislib.elevation.fillDEMSoilleGratin1994(inputDEMImage, validMaskImage, outFilledImage, 'KEA')

Masking

rsgislib.elevation.shadowmask(inputImage, outputImage, solarAzimuth, solarZenith, maxHeight, gdalformat)

Calculates a shadow mask given an input elevation model

Where:

  • inputImage is a string containing the name and path of the input DEM file.
  • outputImage is a string containing the name and path of the output file.
  • solarAzimuth is a float with the solar azimuth in degrees.
  • solarZenith is a float with the solar zenith in degrees.
  • maxHeight is a float with the maximum height for the ray tracing (should be above the maximum elevation within the scene).* gdalformat is a string with the output image format for the GDAL driver.

Incidence / Existance Angle

rsgislib.elevation.localIncidenceAngle(inputImage, outputImage, solarAzimuth, solarZenith, gdalformat)

Calculates a local solar incidence angle layer given an input elevation model

Where:

  • inputImage is a string containing the name and path of the input DEM file.
  • outputImage is a string containing the name and path of the output file.
  • solarAzimuth is a float with the solar azimuth in degrees.
  • solarZenith is a float with the solar zenith in degrees.
  • gdalformat is a string with the output image format for the GDAL driver.
rsgislib.elevation.localExistanceAngle(inputImage, outputImage, azimuth, zenith, gdalformat)

Calculates a local solar existance angle layer given an input elevation model

Where:

  • inputImage is a string containing the name and path of the input DEM file.
  • outputImage is a string containing the name and path of the output file.
  • azimuth is a float with the solar azimuth in degrees.
  • zenith is a float with the solar zenith in degrees.
  • gdalformat is a string with the output image format for the GDAL driver.

Visualisation

rsgislib.elevation.hillshade(inputImage, outputImage, solarAzimuth, solarZenith, gdalformat)

Calculates a hillshade layer given an input elevation model

Where:

  • inputImage is a string containing the name and path of the input DEM file.
  • outputImage is a string containing the name and path of the output file.
  • solarAzimuth is a float with the solar azimuth in degrees (Good value is 315).
  • solarZenith is a float with the solar zenith in degrees (Good value is 45).
  • gdalformat is a string with the output image format for the GDAL driver.