GRASS logo

NAME - Build a linked stream network: each link knows its downstream link


vector, stream network, hydrology, geomorphology

SYNOPSIS --help map=name [upstream_easting_column=string] [upstream_northing_column=string] [downstream_easting_column=string] [downstream_northing_column=string] [tostream_cat_column=string] [--help] [--verbose] [--quiet] [--ui]


Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


map=name [required]
Vector stream network from
Or data source for direct OGR access
Upstream easting (or x or lon) column name
Default: x1
Upstream northing (or y or lat) column name
Default: y1
Downstream easting (or x or lon) column name
Default: x2
Downstream northing (or y or lat) column name
Default: y2
Adjacent downstream segment category
Zero (0) indicates off-map flow
Default: tostream

Table of contents

DESCRIPTION populates the attribute table of a river network built by with five new columns that define the nodes and links within a river network. These are (default names given): Any stream-like network will work, but the lines need to be connected. In terms of graph theory, a tree and forest are supported. Behavior for a cyclic graph is undefined.


streams is a set of vector lines that is generated by It is recommended to be built as follows (Python code):
# Choose elevation map and threshold
elevation = srtm
threshold = 1E6 # [m**2], minimum catchment size = 1 km**2
# Build a map of cell areas: pick one of these
# km2 is more intuitive, but 1 km2 is the threshold for the smallest
# threshold catchment size
r.mapcalc('cellArea_meters2 = '+str(reg.nsres)+' * '+str(reg.ewres), overwrite=True)
r.mapcalc("cellArea_km2 = cellArea_meters2 / 10^6", overwrite=True)

# Use r.watershed to build a drainage basin with units of length**2
# instead of arbitrary units (cells)
r.watershed(elevation=elevation, flow='cellArea_meters2', accumulation='drainageArea_m2', drainage='drainageDirection', stream='streams', threshold=thresh, flags='s', overwrite=True)
# Note that this will include areas of negative (i.e. offmap) flow accumulation

# Build watershed network using single-flow-direction (SFD)
print "Building drainage network"
r.stream_extract(elevation=elevation, accumulation='drainageArea_m2', threshold=thresh, d8cut=0, mexp=0, stream_raster='streams', stream_vector='streams', direction='draindir', overwrite=True)




Andrew D. Wickert


Available at: source code (history)

Latest change: Saturday Jul 29 18:49:49 2023 in commit: d683353f77e13263c38f870a8f21f966b80bea51

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

© 2003-2024 GRASS Development Team, GRASS GIS 8.3.3dev Reference Manual