r.contour(1grass)

πŸ’– r.contour β€” contour vibes from your raster, bestie πŸ’–

okay so welcome to r.contour, a GRASS User's Manual page, and honestly? this one is a whole mood. it takes a raster map and ✨ makes you a vector map full of contour lines ✨. that's it. that's the serve.

KEYWORDS: raster, surface, contours, vector πŸŽ€


✨ SYNOPSIS ✨

r.contour
r.contour --help
r.contour [-t] input=name output=name  [step=float]
          [levels=float[,float,...]]   [minlevel=float]   [maxlevel=float]
          [cut=integer]   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

πŸŽ€ FLAGS πŸŽ€

  • -t β€” do not make an attribute table. no table, no problem πŸ’…
  • --overwrite β€” lets output files just bulldoze over existing files like it's nothing
  • --help β€” prints the usage summary, aka "what is this again?"
  • --verbose β€” verbose module output, for when you want the module to yap
  • --quiet β€” quiet module output, for when you want it to shut up (affectionately)
  • --ui β€” forces the GUI dialog to launch. yes, the little window. go off πŸ¦‹

🌸 PARAMETERS 🌸

  • input=name [required] β€” name of the input raster map. the raw material, the source, the blueprint 🧚
  • output=name [required] β€” name for the output vector map. your baby. your creation 🌈
  • step=float β€” the increment between contour levels. like "every 100 meters" energy
  • levels=float[,float,...] β€” a whole list of contour levels, comma-separated, one by one, no cap
  • minlevel=float β€” minimum contour level, the floor, the baseline
  • maxlevel=float β€” maximum contour level, the ceiling, the limit
  • cut=integer β€” minimum number of points for a contour line (and 0 means no limit)
    • Default: 2

πŸ’œ DESCRIPTION πŸ’œ

r.contour produces a vector map of specified contours from the input raster map. it's giving cartography, it's giving terrain, it's giving "look at my pretty elevation lines."

so there's two ways to tell it what contours you want, and you pick your fighter:

  1. a comma-separated list of values in levels πŸ“
  2. some regular increment using the step parameter

when you're stepping, you use minlevel and maxlevel as the minimum and maximum contour values, respectively. and if you don't bother specifying a minlevel or maxlevel? no worries bestie, r.contour just uses the minimum and maximum cell values in the input raster map. it figured it out itself. main character energy πŸ‘‘


πŸ‘‘ NOTES πŸ‘‘

ok so listen closely because this one matters.

r.contour will either step through incremental contours or produce contours from a list of levels. not both. pick a lane. if you specify both a list of levels and a step, the list gets produced and the step gets ignored. literally just sitting there unread like a text left on delivered 😭


Zero is treated as a valid data value by r.contour. so don't be weird about it, zero is a whole valid number and it deserves respect πŸ’€


⚠️ warning bestie ⚠️

If a contour level exactly matches a category value in the raster map, the contour line may backtrack on itself, which causes illegal arcs to be produced in the output vector map. not cute. not iconic. watch out for that one πŸ™ˆ


the optional cut parameter lets you specify a minimum number of raster cells eligible to be included in a contour line written to the output vector map. think of it like a filter β€” it omits spurs, single points, etc., which makes the output more generalized. it's the "no crumbs, no clutter" setting ✨


🌈 EXAMPLES 🌈

example one β€” the Spearfish glow-up πŸ¦‹

in the Spearfish dataset, produce a vector contour map from input raster elevation.dem with contour levels from 1000m to 2000m, a 100m contour step, and a minimum of 200 input raster points contributing to the contour line:

r.contour input=elevation.dem output=elevation_dem_contours \
          minlevel=1000 maxlevel=2000 step=100 cut=200

example two β€” levels, the list edition πŸ’–

for an example of using levels with r.contour, this one uses the elevation map from the North Carolina database:

g.region raster=elevation
r.contour in=elevation out=contours levels=60,90,120,150 --o
d.mon wx0
d.rast elevation_shade
d.vect contours color=red

Contour lines shown on shaded terrain map 🌸


example three β€” step, the increment edition ⭐

for an example of using steps with r.contour, this one uses the LiDAR data derived elevation map from the North Carolina database:

g.region raster=elev_lid792_1m -p
r.contour input=elev_lid792_1m output=elev_lid792_1m_contours \
          minlevel=100 maxlevel=150 step=10

πŸ’… AUTHORS πŸ’…

  • Terry Baker, U.S. Army Construction Engineering Research Laboratory
  • 3/2001: cut parameter and fixes by Andrea Aime (aaime@libero.it)

🌟 SOURCE CODE 🌟

Available at: r.contour source code (history)

Latest change: Monday Dec 22 18:07:47 2025 in commit: cd86ea812e29ba28776cf5a102bf59288f49ce41

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index


Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual

and that's the whole page bestie, GRASS 8.5.0 and r.contour(1grass) and everything 🫢 go make some contours, you're gonna slay πŸŽ€βœ¨

πŸ“¦ where this page comes from