Summary :: Usage :: Parameters :: Outputs :: Warnings :: Limitations :: Code sample


Adds two new fields to the river network recording the Strahler Order of each polyline.‌‌


This tool adds a new numeric field called Strahler which is the Strahler Order of the polyline. It also adds a new field called Segment. If the fields already exist it creates a new field with a simple numeric suffix (e.h. Strahler_1).

The difference between Strahler and segment is best shown in the images below, each strahler reach is a unique segment ID.

Strahler order achieves 6th order (magenta)

Here are the same polylines encoded as segment ID's, one segment for each Strahler reach

Strahler Order

Strahler segment ID

RivEX implements a version of the algorithm developed by Gleyzer et al., 2004 which is documented in the Journal of the American Water Resources Association. Their algorithm uses a fast recursive algorithm to calculate Strahler stream order, stream segments and can dealing with multi-channelled networks. The version RivEX uses is the same logic but implemented using a stack instead of recursion to avoid memory issues. Further details of the algorithm can be found here.

The algorithm expects the polylines of the river network to flow in a source to sea (downhill) direction. If you have not quality controlled the network then you may have lines that cause the algorithm to loop. RivEX will report the problems in an error log table called tblStrahlerOrderFailedPolylines. These lines typically remain zero for their order so as a final quality control this tool reports the number of zero order polylines created, it is up to you to edit the network and resolve the errors, this would typically involve flipping the direction of the line or introduce a break into the network.




Data type

River Network

The river network. For best results the network should be within a File GeoDatabase

Feature Layer

Add Error Log Table to Map

If this is ticked (default) the error log table will be added to the map for your convenience if any errors were found.


Build a Relate for Error Log

If this tick box is checked then the error log table must be loaded into the map and RivEX builds a standard relate between the Error Log table and the river network layer. You can use the relate to help you jump to and review the error.



An updated river network with two new numeric fields recording the Strahler and segment ID. If errors were generated then this tool creates a stand alone table named tblStrahlerOrderFailedPolylines.  The table is created in the RivEX workspace folder and stored in the File GeoDatabase found in ..\RivEX_Workspace\ErrorLogs\fGDB_RivEXErrorLogs.gdb

Advice on the structure of the error log table and how it can be used is found within this section of the manual. Take note of the warning if you plan to construct a model using the error log output in subsequent processing.


To apply stream ordering to artificial grid-like channels can produce some very strange results and should be interpreted with extreme caution.  The logic of the algorithm is expecting a dendritic pattern, not grid patterns or catchments short-circuited by canal system.

With the release of ArcGIS Pro 3.2.1 a switch control appears on parameters that accept tables\feature classes, do not interact with it! More advice here.


  1. Any selection on the input river network is cleared and then the tool processes all polylines in the river network.
  2. River network must not be a compressed dataset.

Code sample

A minimum code example showing how to call this tool in a python script. This can be run in console or your preferred IDE. If you right click on the tool in the RivEX toolbox and select properties you can view parameter order.

import arcpy

# Import RivEX toolbox

    # Input river Feature Class
    fc = r"C:\Temp\ORN\ORN.gdb\ORN"
    # Run RivEX tool adding table to map and creating a relate are set to false
    res = arcpy.scrAttrStrahler_RivEX(fc, False, False)
    # Show output Feature Class name which is same as input 
    updatedfc = res.getOutput(0)
except arcpy.ExecuteError:
    print("FAILED to add Strahler")

Return to top of page