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

Summary


Adds a new field recording the Source ID for each polyline. This attribute is used by many other RivEX tools to optimise network searching. 

Usage


Requirement for using this tool:


To use this tool you must have attributed the network with:



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


If RivEX fails to reach a source it will be unable to assign the polyline a source ID, in this case the polyline is given -1. This scenario can exist if topological errors exist within the network, for example a tributary junction where the inflowing polylines are actually flowing away from the node causing the algorithm to be unable to reach a source node.


With the network encoded with source ID you can click on any polyline and instantly know the source.  The source is defined as the point upstream that is furthest away from the network mouth.  The source ID is the ID of the source node which is the furthest point upstream.



A network colour coded by source ID

A network colour coded by source ID.

Parameters


Name

Help

Data type

River Network

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

Feature Layer

Outputs


An updated river network with a new numeric field recording the Source ID for each polyline.  If RivEX is unable to determine the source (e.g. your network has gridded sections that go around in loops) then the output value will default to -1.

WarningWarnings


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.

Limitations


  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
arcpy.ImportToolbox(r"C:\RivEX_ArcPro\RivEX.atbx")

try:
    # Input river Feature Class
    fc = r"C:\Temp\ORN\ORN.gdb\ORN"
    
    # Run RivEX tool
    res = arcpy.scrAttrSourceID_RivEX(fc)
    
    # Show output Feature Class name which is same as input 
    updatedfc = res.getOutput(0)
    print(updatedfc)
except arcpy.ExecuteError:
    print("FAILED to add Source ID")

Return to top of page