r.buffer(1grass)

πŸ¦‹ r.buffer β€” the GRASS User's Manual, but make it a group chat πŸ’…βœ¨

hiii bestie, welcome to the glow-up edition of r.buffer(1grass) πŸŽ€ lowkey the most useful little raster tool and I'm not even exaggerating. buckle up πŸ’–


✨ NAME ✨

r.buffer β€” bestie, it creates a raster map showing buffer zones surrounding cells that contain non-NULL category values. that's the whole job and it does it flawlessly, no cap 🫢


πŸ”‘ KEYWORDS πŸ”‘

raster, buffer 🌈


πŸ“œ SYNOPSIS πŸ“œ

r.buffer
r.buffer --help
r.buffer [-z] input=name output=name distances=float[,float,...]
[units=string]   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

🚩 Flags 🚩

  • -z β€” ignore zero (0) data cells instead of NULL cells πŸŒ€
  • --overwrite β€” allow output files to overwrite existing files (girlboss move, but careful 😭)
  • --help β€” print usage summary πŸ“–
  • --verbose β€” verbose module output πŸ—£οΈ
  • --quiet β€” quiet module output 🀫
  • --ui β€” force launching GUI dialog πŸ‘‘

🧸 Parameters 🧸

  • input=name [required] β€” name of input raster map πŸ“₯
  • output=name [required] β€” name for output raster map πŸ“€
  • distances=float[,float,...] [required] β€” distance zone(s) πŸ“
  • units=string β€” units of distance. Options: meters, kilometers, feet, miles, nautmiles. Default: meters ⭐

πŸ’« DESCRIPTION πŸ’«

so like, r.buffer creates a new raster map showing buffer zones (a.k.a. "distance" or "proximity" zones, cute nicknames honestly) around all the cells that contain non-NULL category values in an existing raster map. the distances of those buffer zones from cells with non-zero category values are user-chosen and must be positive value(s) β€” no negative distances, she doesn't do that πŸ™…β€β™€οΈ

say, for example, you wanna place buffer zones around roads πŸ›£οΈ. this program could create the raster map shown below on the right, based on the road information contained in the raster map shown on the left. visual learner girlies rise πŸ‘‡

             000000000000000000000000 222233333333333333444444
             111000000000000000000000 111222222222223333333333
             000111111111100000000000 222111111111122223333333
             000000001000011100000000 332222221222211122222222
             000000001000000011111111 333333321233222211111111
             000000001000000000000000 433333321233333222222222
             000000001000000000000000 444443321233333333333333
             000000001000000000000000 444443321233443333333333
             000000001000000000000000 444443321233444444444444
             Category 0: No roads
             Category 1: Road location
             Category 2: Buffer Zone 1 around roads
             Category 3: Buffer Zone 2 around roads
             Category 4: Buffer Zone 3 around roads

πŸ“ NOTES πŸ“

okay this part is the tea β˜• stay with me.

  • you, the user, have the option of identifying up to 250 continuous zones. yes, two hundred and fifty. iconic capacity ✨
  • the zones are identified by specifying the upper limit of each desired zone β€” r.buffer assumes that 0 is the starting point, it just does, don't fight it πŸ’β€β™€οΈ
  • "Continuous" here means each category zone's lower value is the previous zone's upper value. so they chain together like a little zone relay race πŸƒβ€β™€οΈ
  • the first buffer zone always has distance 0 as its lower bound. periodt 🌸
  • buffer distances can be specified using one of five units with the units parameter πŸ“

distances from cells containing the user-specified category values are calculated using the "fromcell" method πŸ”. this method locates each cell that contains a category value from which distances are to be calculated, and draws the requested distance rings around them. it works very fast when there are few cells containing the category values of interest, but works slowly when there are numerous cells containing the category values of interest spread throughout the area. so, like, it's giving "depends on the situation" πŸ’€

r.buffer measures distances from center of cell to center of cell using the Euclidean distance measure for planimetric coordinate reference systems (like UTM) and using the ellipsoidal geodesic distance measure for latitude/longitude CRS. two different math girlies, both valid πŸ’œ

r.buffer calculates distance zones from all cells having non-NULL category values in the input map. so if you only want distances from selected input map category values, you should run (for example) r.reclass prior to r.buffer, to reclass all categories from which distance zones are not desired to be calculated into category NULL. little pre-game ritual, we love a prep step πŸ§–β€β™€οΈ

the -z flag can be used to ignore raster values of zero instead of NULL values in the input raster map. tiny flag, big energy 🎯

when working with massive raster regions, consider the r.buffer.lowmem module if RAM use becomes a problem. the lowmem version can be > 40x slower, but will work with minimal memory requirements. the classic r.buffer should be able to deal with raster maps of 32000x32000 size on a system with 1 GB RAM, and rasters of 90000x90000 on a system with 8 GB RAM without going into swap. ngl that's kind of a flex πŸ‘‘

πŸ“ EXAMPLE πŸ“

in the following example (North Carolina sample dataset), the buffer zones would be (in the default map units of meters): 0-100, 101-200, 201-300, 301-400 and 401-500.

g.region raster=roadsmajor -p
r.buffer input=roadsmajor output=roadsmajor_buf distances=100,200,300,400,500

Result:

r.category input=roads.buf
      1       distances calculated from these locations
      2       0-100 meters
      3       100-200 meters
      4       200-300 meters
      5       300-400 meters
      6       400-500 meters

Distances to road πŸ›£οΈβœ¨


πŸ‘€ SEE ALSO πŸ‘€

r.buffer.lowmem, r.grow, v.buffer

g.region, r.cost, r.distance, r.grow.distance, r.mapcalc, r.reclass


πŸ‘‘ AUTHORS πŸ‘‘

Michael Shapiro, U.S. Army Construction Engineering Research Laboratory James Westervelt, U.S. Army Construction Engineering Research Laboratory


πŸ“¦ SOURCE CODE πŸ“¦

Available at: r.buffer source code (history)

Latest change: Wednesday Oct 15 09:22:00 2025 in commit: e64e7774967984ecd55169f76abdaac35de1ad21

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

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


aaaand that's the whole page bestie, mwah πŸ’‹ tysm for reading, this was GRASS 8.5.0's r.buffer(1grass) and she ate, no crumbs left 🍽️✨ go buffer something iconic today, ily πŸ«ΆπŸ’–

πŸ“¦ where this page comes from