Calculate Strahler Stream Order Numbers

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

Introduction

Stream order can be used to identify and classify stream types based on the number of tributaries connected to it. This tutorial will cover preparing your data before using the StreamOrderCalculator transformer to determine stream order based on the Strahler Algorithm. The Strahler algorithm classifies streams without a tributary as order 1.
 

Step-by-step Instructions

Using a Digital Elevation Model of the area of interest allows us to determine the flow direction of the streams using elevation.

Source
The first source dataset is a digital elevation model of the area surrounding Austin, Texas. 
DEMInput.png

The second dataset is a MapInfo MIF dataset of the hydrology surrounding Austin, Texas. 
HydroInput.png

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add a U.S. Geological Survey Digital Elevation Model (USGSDEM) Reader
Add a U.S. Geological Survey Digital Elevation Model (USGSDEM) 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 U.S. Geological Survey Digital Elevation Model (USGSDEM) as the Format, then for Dataset, browse to the RasterDEM-250K.dem dataset, which is available for download from the Files section on this article. Then click OK to finish adding the reader.
DEMReader.png
 
3. Reproject 
Click on the USGS_DEM reader feature type to select it.  Then add a Reprojector transformer to the canvas by typing “Reprojector” to bring up the list of FME Transformers in the Quick Add Search. Select the Reprojector from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
QuickADd.png
Connection.png
 
Double-click on the Reprojector to open the parameters. In the parameters, set the Destination Coordinate System to TX83-CF, then click OK. 
Reprojector.png
 
4. Remove Attributes
We don’t need any of the attributes coming from the DEM. Add an AttributeKeeper to the canvas and connect it to the Reprojector. Since we don’t need to keep any attributes, we can leave the default parameters. 
 
5. Add Stream Data
Add another reader to the canvas, and set the Format to Precisely MapInfo MIF/MID. Then browse to the HydrographyLine.mif dataset. 
Mifreader.png
 
6. Remove Lakes
Since we are only interested in streams, we will need to remove the line data that creates lakes or other bodies of water. Add an AreaBuilder to the canvas and connect it to the HydrographyLines reader feature type.

In the parameters, set the Accumulation Mode to Drop Incoming Features.AreaBuilder.png

7. Generate Network IDs
We need to create a unique ID for each of the streams. To do this, we will use the NetworkTopologyCalculator transformer, which will assign a _network_id attribute to all of the lines which participate in a network. Add the NetworkTopologyCalculator to the canvas and connect it to the Incomplete output port on the AreaBuilder. There are no parameters to set. 
NetowrkConnection.png
 
8. Create Topology
Next, we can create the topology. Add a TopologyBuilder to the canvas and connect it to the Network output port on the NetworkTopologyCalculator. 

In the parameters, enable Group Processing, then set the Group By parameter to _network_id.  This transformer will build topology on the lines within a particular network. Here we are only interested in the nodes to determine the lowest node in a network to find the direction the stream is flowing. 
 TopoBuilder.png

9. Find Elevation Values
Now that we have joined all our lines based on _network_id using the TopologyBuilder, we can determine the elevation for each node within the line. Add a PointOnRasterValueExtractor transformer to the canvas and connect the Raster input port to the Output port on the AttributeKeeper. Then connect the Point input port to the Node output port on the TopologyBuilder. PONROConnection.png
 
We can accept the default parameters. This will overlay the stream data on the raster dem and then extract the elevation, which will be the attribute _band{0}.value, which is the elevation.
 
10. Sort Values
Add a Sorter to the canvas and connect it to the Point output port on the PointOnRasterValueExtractor. 

In the parameters, set the following:

Attribute Alpha/Num Order
_band{0}.value Numeric Ascending
_network_id Numeric Ascending

Sirter.png

11. Calculate the Minimum Elevation
Next, let’s calculate the minimum elevation. Add a StatisticsCalculator to the canvas and connect it to the Sorter. 
 
In the parameters, enable Group Processing, then set Group By to _network_id. Next, set the Attributes to Analyze to _band{0}.value and select Min. 
StatsCalc.png
 
12. Find Node with Lowest Elevation
To find the node with the lowest elevation, we will use the Matcher. Add a Matcher to the canvas and connect both the Sorter Sorted output port and the Summary output port from the  StatisticsCalculator to the Matcher input port. 
 MatcherConnect.png

In the parameters, click on the ellipsis for Selected Attributes and select _network_id, then uncheck Check Geometry. 
Matcher.png
 
13. Calculate Stream Order
Using the StreamOrderCalculator transformer, we will calculate the stream order based on the Strahler algorithm. Add a StreamOrderCalculator to the canvas and connect the Line input port to the Edge output port on the TopologyBuilder and then connect the Destination input port to the SingleMatched output port on the Matcher.
StreamOrderConnect.png

In the parameters, enable Group Processing and then set Group By to _network_id. Next, set the Fix Flow Direction of Input to Yes and set the Stream Order Type to Strahler.
StreamOrder.png
 
14. Run Workspace
Connect an Inspector transformer to the Network output port on the StreamOrderCalculator. Then connect the same Inspector to the Area output port on the AreaBuilder transformer; this will add the lakes back in when we inspect the data.

You can right-click on the connection to the Area output port and select Create Tunnel to clean up the canvas if desired. 
CreateTunnel.png
Inspector.png
 
Open the Inspector parameters, and enable Group Processing, set the Group By to _strahler_order. 
InspectorParams.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, open the Display Control pane, double-click on the Inspector_(29) to open the style parameters, set the Fill Color to blue (0,0.333333,1), then change the Fill Opacity to 0.2, and click OK. This is the lakes, click and drag to move Inspector_(29) to the bottom of the list.  
StreamInspect.png
GeomStyle.png
 
Next repeat for the other Inspectors:

  • Inspector_1(46): 
    • Color: Light blue (​​0.333333,0.666667,1)
    • Width: 2
  • Inspector_2(15):
    • Color: Blue (0.333333,0.333333,1)
    • Width: 4 
  • Inspector_3(5):
    • Color: Dark blue (0,0,1)
    • Width: 6
  • Inspector_4(1)
    • Color: Black (0,0,0)
    • Width: 7

 
 Output.png

One remaining issue is that if the stream segment is relatively flat so that the elevation of each end of the stream is the same, then the workspace may not correctly identify the low point of the stream. This happens to the small network in the upper left-hand corner of this image. Two low points (nodes) are passed into the StreamOrderCalculator, and it can only make use of one of them. It may not be the correct one, so additional logic may be required to resolve this issue.

 

Data Attribution

Data provided by the City of Austin and Travis County, Texas

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.