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 flowline of flowlines
  • a raster map flowlength of flowpath lengths
  • a raster map flowaccumulation of 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.flow has 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.dir can 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 (see g.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