Raster Slope Calculations

Liz Sanderson
Liz Sanderson
  • Updated

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. 

Data Source

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

Step-By-Step Instructions

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 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, set the following:

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 the RasterSlopeCalculator, you can change the Algorithm, which can affect 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 the Run button on the top toolbar, or by selecting Run > Run Workspace from the top menu bar. 

Run.png

In Data Preview (formerly 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, ranging from 0 to 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 Data 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 will use raster data and the RasterSlopeCalculator to calculate land suitability for development. Building developments usually prefer flat, low-lying land.

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 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, set the following:

  • Format: Canadian Digital Elevation Data (CDED)
  • Dataset: DEM-Clipped.dem
    • Click on the ellipses to navigate to the location of the file on your computer

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 the RasterSlopeCalculator, you can change the Algorithm, which can affect the output. 

RAC.png

4. Calculate Raster Cell Values

Add a RasterCellValueCalculator to the canvas, connect the A input port to the CDED reader feature type, and 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 the Run button on the top toolbar, or by selecting Run > Run Workspace from 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 open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?

We're sorry to hear that.

Please tell us why.

As of January 14th, 2026, comments on knowledge base articles have been closed. To make sure questions don’t get missed and to enable more community support, we’ve moved discussions to the FME Community. If you have a question or a comment about this article, please create a new post or create a support ticket.