Calculate Strahler Stream Order Numbers

Liz Sanderson
Liz Sanderson
  • Updated

Introduction

Stream order can be used to identify and classify stream types based on the number of tributaries it receives. 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.

Source Data

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

Step-by-step Instructions

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

To follow along with the tutorial, download the data from the article's Files section.

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 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.

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 attributes 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 following:

  • Format: Precisely MapInfo MIF/MID
  • Dataset: HydrographyLine.mif

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 stream. To do this, we will use the NetworkTopologyCalculator transformer, which will assign a _network_id attribute to all of the lines that 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 as the attribute _band{0}.value.

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: _band{0}.value
    • Alpha/Num: Numeric
    • Order: Ascending
  • Attribute: _network_id
    • Alpha/Num: Numeric
    • Order: Ascending

Click OK.

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 stream order using 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 restore the lakes 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 the Run button on the top toolbar, or by selecting Run > Run Workspace from the top menu bar.

Run.png

In Data 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 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, with the elevations at both ends the same, the workspace may not correctly identify the stream's low point. 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

The data used in this article originates from open data made available by the City of Austin, Texas. It contains data licensed under the Public Domain Dedication License, as provided by the City of Austin.

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.