Raster Slope Calculations

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0

Introduction

Raster slopes can be measured in two ways: the slope angle and the slope aspect (direction). In FME, slope angle is measured with the RasterSlopeCalculator transformer and slope aspect with the RasterAspectCalculator.
In this tutorial, we will try each of these transformers to see what they do and then use the RasterSlopeCalculator in a workspace that assesses land-use capabilities.
  

Video


This video was recorded using an older version of FME. The user interface may appear different but the concepts are the same. 

 

Step-By-Step Instructions

Source Data

The source data for these examples is a Raster DEM dataset in CDED format. The lighter the color, the higher the elevation. Darker areas represent low-lying areas.

gisrasterslope1.png

Exercise 1: Calculate Slope and Aspect

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add a CDED (Canadian Digital Elevation Data) Reader
Add a CDED (Canadian Digital Elevation Data) reader to the canvas by clicking on the Reader button on the top menu bar or by going to Readers > Add Reader. In the Add Reader dialog, select CDED (Canadian Digital Elevation Data) as the Format, then for Dataset, browse to the DEM-Clipped.dem dataset, which is available for download from the Files section on this article. Then click OK to finish adding the reader.
Reader.png

3. Calculate the Slope
Click on the CDED reader feature type to select it.  Then add a RasterSlopeCalculator transformer to the canvas by typing “RasterSlopeCalculator” to bring up the list of FME Transformers in the Quick Add Search. Select the RasterSlopeCalculator from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
QuickAdd.png
ConnectionRS.png 

There are no parameters to set, but if you open the parameters by double-clicking on the RasterSlopeCalculator, note that you can change the Algorithm, which can vary the output. 
RAC.png
 
4. Calculate the Aspect
Add a RasterAspectCalculator to the canvas and connect it to the CDED reader feature type. 
 Connection2.png

Again, there are no parameters to set, but note that you can also change the Algorithm in this transformer. 
RSC.png
 
5. Run Workspace
Connect an Inspector transformer to the RasterSlopeCalculator output port, then connect another Inspector to the RasterAspectCalculator. 
Workspace.png
 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
Run.png
 
In Visual Preview, the RasterSlopeCalculator output will have slope represented for each cell instead of elevation. Note the bright spots in the center and right of the image; these are low-lying features but have a steep slope. 

gisrasterslope3.png

The RasterAspectCalculator output has each cell representing the direction of the slope, from 0-360 degrees. 

gisrasterslope4.png

6. (Optional) Adjust Slope Aspect for Display 
We can adjust the slope aspect for a better display using the RasterExpressionEvaluator transformer.
Place a RasterExpressionEvaluator into the workspace between the RasterAspectCalculator and the Inspector it is connected to. 
REE.png
 
Open the RasterExpressionEvaluator parameters, and set Interpretation to Preserve, then paste in the following for Expression: 

if (A[0]>180,@abs(A[0]-360),A[0])

This will cause the aspect to be calculated from 0 to 180 both clockwise and anti-clockwise. 
RasterExpressionEval.png 

Rerun the workspace and view the output in Visual Preview. Notice how the coloring is now more consistent, making it easier to see the dark areas that face north.

gisrasterslope5.png

Exercise 2: Calculate Low Lying Area

This exercise is going to use raster data and the RasterSlopeCalculator to calculate the suitability of land for development. Building developments usually prefer land that is both flat and low-lying.

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add a CDED (Canadian Digital Elevation Data) Reader
Add a CDED (Canadian Digital Elevation Data) reader to the canvas by clicking on the Reader button on the top menu bar or by going to Readers > Add Reader. In the Add Reader dialog, select CDED (Canadian Digital Elevation Data) as the Format, then for Dataset, browse to the DEM-Clipped.dem dataset, which is available for download from the Files section on this article. Then click OK to finish adding the reader.
Reader.png
 
3. Calculate the Slope
Click on the CDED reader feature type to select it.  Then add a RasterSlopeCalculator transformer to the canvas by typing “RasterSlopeCalculator” to bring up the list of FME Transformers in the Quick Add Search. Select the RasterSlopeCalculator from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
QuickAdd.png
ConnectionRS.png
 
There are no parameters to set, but if you open the parameters by double-clicking on the RasterSlopeCalculator, note that you can change the Algorithm, which can vary the output. 
RAC.png

4. Calculate Raster Cell Values
Add a RasterCellValueCalculator to the canvas and connect the A input port to the CDED reader feature type, then connect the B input port to the RasterSlopeCalculator Output port. 
RasterCellConnect.png
 
In the parameters, change the Operator to + (plus sign) and click OK. This will add the original data (representing elevation) to the transformed data (representing slope). The result will represent the suitability of each cell for building development. 
RasterCellValue.png
 
5. Run Workspace
Connect an Inspector transformer to the RasterCellValueCalculator Output port. 
Workspace3.png
 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
Run.png
 
In Visual Preview, the lighter colors represent cells with both a steep slope and a higher elevation. Darker colors represent cells with both a shallow slope and a low elevation.

gisrasterslope7.png

 

Data Attribution

The data used here originates from data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.