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

Summary


Adds a new numeric field recording the total upstream length of the network for each polyline.

Usage


This tool adds a new numeric field called US_Accum which is the total upstream length of the network for each polyline. If the field exists it creates a new field with a simple numeric suffix (e.g. US_Accum_1). 


Recorded length will be in the units of the coordinate system, so this attribute is appropriate for datasets in feet or metres. 


The image below demonstrates how RivEX deals with braided networks. Red numbers are the lengths of the polyline and black numbers are the accumulated lengths which would be written back to the network dataset. 


Summing upstream length

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 (US_Accum) recording the total upstream length of the network for each polyline. The total upstream length includes the length of the polyline itself.

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. This tool will not process data that has a latitude/longitude coordinate system (e.g. WGS84).  You need to project your river network into a coordinate system that uses metres or feet.
  2. Any selection on the input layer is cleared and then the tool processes all polylines in the river network.
  3. 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.scrAttrUpstreamLength_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 Loop ID")

Return to top of page