r.flow(1)
π r.flow(1) β GRASS GIS User's Manual π
okay bestie, sit down, hydrate, because we're about to talk about r.flow β the GRASS GIS flowline girlie. this is the page for r.flow in the GRASS GIS User's Manual, and yes she is iconic, yes she is hydrology-coded, and yes we are going to get through <em>every single detail</em> together. no skimming. periodt. β¨
π NAME π
r.flow β she constructs flowlines. π¦
Like, literally: she computes flowlines</>, flowpath lengths</>, and flowaccumulation</> (that's contributing areas, bestie) from an elevation raster map. that's the whole vibe. π
π KEYWORDS π
raster, hydrology
iykyk. that's the category tag, that's the whole energy. π§
π SYNOPSIS π
r.flow
r.flow --help
r.flow [-u3m] elevation=name [aspect=name] [barrier=name]
[skip=integer] [bound=integer] [flowline=name] [flowlength=name]
[flowaccumulation=name] [--overwrite] [--help] [--verbose]
[--quiet] [--ui]
π© Flags
-uβ compute upslope</> flowlines instead of the default downhill flowlines. going up instead of down, main character behavior.-3β lengths in 3D</> instead of 2D. we're not flat, we contain multitudes.-mβ use less memory</>, at a performance penalty. she's frugal but she's slow about it. π--overwriteβ allow output files to overwrite existing files. girl, permission to replace granted. π--helpβ print usage summary. the "what do i do" button.--verboseβ verbose module output. she will <em>tell you everything</em>.--quietβ quiet module output. she will tell you <em>nothing</em>. π€«--uiβ force launching GUI dialog. pop the window, bestie. π
ποΈ Parameters
elevation=nameβ[required]β Name of input elevation raster map. the <em>main character</em> input, fr fr.aspect=nameβ Name of input aspect raster map.barrier=nameβ Name of input barrier raster map.skip=integerβ Number of cells between flowlines.bound=integerβ Maximum number of segments per flowline.flowline=nameβ Name for output flow line vector map.flowlength=nameβ Name for output flow path length raster map.flowaccumulation=nameβ Name for output flow accumulation raster map.
β¨ DESCRIPTION β¨
so r.flow generates flowlines using a combined raster-vector approach</> β she's doing both, she's versatile β (see Mitasova and Hofierka 1993 and Mitasova et al. 1995 for the receipts, bestie) from an input elevation raster map (which can be integer or floating point</>), and optionally an input aspect raster map and/or an input barrier raster map. she's flexible like that. π«Ά
and there are three possible output raster maps, and you can produce them in any combination simultaneously</>:
- a vector map
flowlineof flowlines - a raster map
flowlengthof flowpath lengths - a raster map
flowaccumulationof flowline densities
and that last one β the flowline densities β those are equal to the upslope contributed areas per unit width</>, when multiplied by resolution. note that. write it down. it comes back later. π
π NOTES π
first things first: the aspect you feed in for input must follow the same rules as aspect computed in other modules. check v.surf.rst or r.slope.aspect if you're confused. she's not going to explain it again. π
Output flowline is generated downhill. the line segments of flowline vectors have endpoints on the edges of a grid β that grid is formed by drawing imaginary lines through the centers of the cells in the elevation map. imagine it. it's giving geometry class but make it hydrology.
flowlines are generated from each cell downhill by default, but bestie, you can flip that β generate them uphill with the -u flag. π
a flowline stops if:
- its next segment would reverse the direction of flow (from up to down, or vice-versa) π΅
- it crosses a barrier π§
- it arrives at a cell with undefined elevation or aspect β
another option: skip. this says only the flowlines from every val-th cell get included in flowline. and the default skip? it's:
max(1, <rows in elevation>/50, <cols in elevation>/50)
a high skip usually speeds up processing time</> and often improves the readability</> of a visualization of flowline. so, like, less is more, but the other way around. π
π flowlength
the flowpath length output is given in a raster map called flowlength. the value in each grid cell is the sum of the planar lengths of all segments</> of the flowline generated from that cell. and if you pass the -3 flag, then elevation gets taken into account when calculating the length of each segment. 3D girlie behavior. π¦
π flowaccumulation
the flowline density, downhill or uphill, is output in a raster map called flowaccumulation. the value in each grid cell is the number of flowlines which pass through that grid cell</> β meaning, the number of flowlines from the entire map that have segment endpoints within that cell.
now, with the -m flag, less memory is used</> because aspect at each cell is computed <em>on the fly</em>. sounds cute right? wrong. this option incurs a severe performance penalty. π and if this flag is given, the aspect input map (if any) will be ignored. gone. bye.
also, the barrier parameter is a raster map name with non-zero values</> representing barriers as input. π§
π― for best results
use input elevation maps with high precision units</> (e.g., centimeters) so that flowlines do not terminate prematurely in flat areas. trust. π
to prevent the creation of <em>tiny flowline segments with imperceivable changes in elevation</em>, an endpoint which would land very close to the center of a grid cell gets quantized to the exact center of that cell. the maximum distance between the intercepts along each axis of a single diagonal segment and another segment of 1/2 degree different aspect is taken to be "very close" for that axis. note that this distance (the so-called "quantization error") is about 1-2% of the resolution on maps with square cells. cute little number. π
β°οΈ the -u flag values
the values in length maps computed using the -u flag represent the distances from each cell to an upland flat or singular point</>. such distances are useful in water erosion modeling for computation of the LS factor in the standard form of USLE. π
uphill flowlines <em>merge on ridge lines</em> β and by redirecting the order of the flowline points in the output vector map, dispersed waterflow can be simulated. the density map can be used for the extraction of ridge lines. slay. π
π§οΈ downhill flowlines
computing the flowlines downhill simulates the actual flow β also known as the raindrop method. π§οΈ these flowlines tend to <em>merge in valleys</em>; they can be used for localization of areas with waterflow accumulation and for the extraction of channels.
the downslope flowline density multiplied by the resolution can be used as an approximation of the upslope contributing area per unit contour width. this area is a measure of potential water flux for the steady state conditions, and can be used in the modeling of water erosion for the computation of the <em>unit stream power based LS factor</em> or <em>sediment transport capacity</em>. big science words, but she ate. π
β οΈ important reality check:r.flowhas been designed for modeling erosion on hillslopes and has rather strict conditions for ending flowlines. it is therefore not very suitable for the extraction of stream networks or delineation of watersheds β unless a DEM without pits or flat areas is available (r.fill.dircan be used to fill pits).
to label the vector flowlines automatically, the user can use v.category (add categories). π·οΈ
π§ Algorithm background
r.flow uses an original vector-grid algorithm</> which uses an infinite number of directions between 0.0000... and 360.0000... and traces the flow as a line (vector) in the direction of gradient β rather than from cell to cell in one of the 8 directions, which would be the D-infinity algorithm. they are traced in any direction using aspect (so there is no limitation to 8 directions here). π
the D8 algorithm produces <em>zig-zag lines</em>. the value in the outlet is very similar for the r.flow algorithm (because it is essentially the watershed area), however the spatial distribution of flow, especially on hillslopes, is <em>quite different</em>. it is still a 1D flow routing so the dispersal flow is not accurately described, but still better than D8. we love an upgrade. β¨
and r.flow uses a single flow algorithm, i.e. all flow is transported to a single cell downslope. one destination. no detours. main character energy. π
π©Ί Diagnostics
Elevation raster map resolution differs from current region resolutionβ the resolutions of all input raster maps and the current region must match (seeg.region). check your region bestie. πResolution too unbalancedβ the difference in length between the two axes of a grid cell is so great that quantization error is larger than one of the dimensions. resample the map and try again. π«
πΈ EXAMPLE πΈ
in this example a flow line vector map, a flow path length raster map and a flow accumulation raster map are computed from an elevation raster map (North Carolina sample dataset):
g.region raster=elevation -p
r.flow elevation=elevation skip=3 flowline=flowline flowlength=flowlength \
flowaccumulation=flowaccumulation
look at her go. π¦
Figure: Flow lines with underlying elevation map; flow lines with underlying flow path lengths (in map units: meters); flow accumulation map (zoomed view)
π REFERENCES π
- Mitasova, H., L. Mitas, 1993, Interpolation by regularized spline with tension : I. Theory and implementation. Mathematical Geology 25, p. 641-655. (online)
- Mitasova and Hofierka 1993 : Interpolation by Regularized Spline with Tension: II. Application to Terrain Modeling and Surface Geometry Analysis. Mathematical Geology 25(6), 657-669 (online).
- Mitasova, H., Mitas, L., Brown, W.M., Gerdes, D.P., Kosinovsky, I., Baker, T., 1995: Modeling spatially and temporally distributed phenomena: New methods and tools for GRASS GIS. International Journal of Geographical Information Systems 9(4), 433-446.
- Mitasova, H., J. Hofierka, M. Zlocha, L.R. Iverson, 1996, Modeling topographic potential for erosion and deposition using GIS. Int. Journal of Geographical Information Science, 10(5), 629-641. (reply to a comment to this paper appears in 1997 in Int. Journal of Geographical Information Science, Vol. 11, No. 6)
- Mitasova, H.(1993): Surfaces and modeling. Grassclippings (winter and spring) p.18-19.
π SEE ALSO π
r.basins.fill, r.drain, r.fill.dir, r.water.outlet, r.watershed, v.category, v.to.rast
go read those next bestie, the lore goes deep. π
π AUTHORS π
Original version of program: Maros Zlocha and Jaroslav Hofierka, Comenius University, Bratislava, Slovakia πΈπ°
The version of the program (adapted for GRASS 5.0): Joshua Caplan, Mark Ruesink, Helena Mitasova, University of Illinois at Urbana-Champaign with support from USA CERL. GMSL/University of Illinois at Urbana-Champaign
πΎ SOURCE CODE πΎ
Available at: r.flow source code (history)
Accessed: Saturday Jan 17 05:40:46 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page, bestie!! π this was the r.flow manual page for <strong>GRASS 8.4.2</strong> β accessed Saturday Jan 17 05:40:46 2026 β and the copyright situation is Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual. she's been around a while and she's still serving. π
β¨ stay hydrated, go compute some flowlines, and remember: the vibe changes but the facts never do. ππ¦πΈ
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms