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


Adds a new field recording the Loop ID for each polyline.


This tool adds a new numeric field called LoopID, if the field already exist it creates a new field with a simple numeric suffix (e.g. LoopID_1). 

The tool will identify all polylines participating in a loop and encode the loop with an unique ID number. River networks generated from vectorizing raster stream networks do not have bifurcations and will not be attributed with loop ID's.

The ID will start at 1 and count up for each loop family. Polylines remaining as zero do not participate in any loop.

A loop is a component of the network that has two or more channels. Imaging a fish attempting to swim upstream and it comes to a bifurcation. One side of the bifurcation could split again creating a multi-threaded section of network. These loops could be naturally occurring braiding, anastomosing channels or artificial channels associated with anthropogenic structures like water meadows or mills. Thus a loop in RivEX could be a simple bifurcation or a highly threaded braiding system.

In the image below a small section of the Alaskan NHD has been processed by RivEX and polylines in loops are colour coded by the unique ID given to the loop. You can see along the main stem, a long multi-threaded loop (green) with smaller simple loops (pink) upstream.

Network colour coded by loop ID

Once the network is encoded by LoopID you could generate statistics on the number of loops in a network, their size and distribution and use them to identify if a barrier is passable.

If a barrier (point) has been snapped to the network and you transfer the LoopID to it. The fact that it has a LoopID must mean there is an alternate route which is vital when considering the potential  passibility of a barrier.

Large networks will have large topological dictionaries and will take longer to process. The topological nature of the river network can also influence processing time; highly multi-threaded channels tend to take longer to process.




Data type

River Network

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

Feature Layer


An updated river network with a new numeric field recording the loop ID of each polyline.  A zero value indicates the polyline is not part of a loop.


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 layer 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
    res = arcpy.scrAttrLoops_RivEX(fc)
    # Show output Feature Class name which is same as input 
    updatedfc = res.getOutput(0)
except arcpy.ExecuteError:
    print("FAILED to add Loop ID")

Return to top of page