FME Version
Files
-
- 200 KB
- Download
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.
Exercise 1: Calculate Slope and Aspect
1. Create a New Workspace
Open FME Workbench and create a blank workspace.
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.
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.
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.
4. Calculate the Aspect
Add a RasterAspectCalculator to the canvas and connect it to the CDED reader feature type.
Again, there are no parameters to set, but note that you can also change the Algorithm in this transformer.
5. Run Workspace
Connect an Inspector transformer to the RasterSlopeCalculator output port, then connect another Inspector to the RasterAspectCalculator.
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar.
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.
The RasterAspectCalculator output has each cell representing the direction of the slope, from 0-360 degrees.
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.
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.
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.
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.
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.
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.
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.
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.
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.
5. Run Workspace
Connect an Inspector transformer to the RasterCellValueCalculator Output port.
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar.
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.
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.
Comments
0 comments
Please sign in to leave a comment.