r.buffer(1)
π NAME π
r.buffer β creates a raster map showing buffer zones surrounding cells that contain non-NULL category values. It's giving distance rings around your fave cells and honestly? Iconic. β¨
πΈ 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--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 mapoutput=name[required] β Name for output raster mapdistances=float[,float,...][required] β Distance zone(s)units=stringβ Units of distance- Options:
meters,kilometers,feet,miles,nautmiles - Default:
meters
- Options:
π¦ DESCRIPTION π¦
So bestie, r.buffer creates a brand-new raster map showing buffer zones (aka "distance" zones, aka "proximity" zones β same energy, different name π
) around all the cells that contain non-NULL category values in a raster map you already have.
The distances of those buffer zones out from the cells with non-zero category values? Totally your call, and they must be positive value(s). No negative zones, we don't do that here.
Say you wanna put buffer zones around roads. This module could make the raster map on the right based on the road info in the raster map on the left. Look:
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 so here's the tea π΅:
You've got the option of identifying up to 250 continuous zones. You name each zone by specifying the upper limit of that zone (r.buffer just assumes 0 is the starting point, periodt).
"Continuous" here means each category zone's lower value is literally the previous zone's upper value. And the very first buffer zone always has distance 0 as its lower bound β that's just the rules. Buffer distances can be specified in one of five units using the units parameter.
Distances from cells containing the category values you picked are calculated using the "fromcell" method. What does that even mean? It locates every single cell that contains a category value you want distances from, then draws the requested distance rings around them. β¨
This method 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. iykyk π
r.buffer measures distances from center of cell to center of cell using Euclidean distance measure for planimetric coordinate reference systems (like UTM) and using ellipsoidal geodesic distance measure for latitude/longitude CRS. Two different vibes, depending on your CRS.
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 before r.buffer, to reclass all the categories you don't want distance zones from into category NULL. Clean that up first, bestie.
The -z flag can be used to ignore raster values of zero instead of NULL values in the input raster map. π
When working with massive raster regions, consider the r.buffer.lowmem module if RAM use becomes a problem. Heads up though β the lowmem version can be > 40x slower, but it 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. That's the range, no cap. π₯
π 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.bufferg.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)
Accessed: Saturday Jan 17 05:40:43 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Okay that's the whole thing, bestie β and this lil manual page you just read lives in the GRASS GIS 8.4.2 Reference Manual, brought to you by the GRASS Development Team with Β© 2003-2025 energy. π«Ά Run it, love it, buffer responsibly. πβ¨
π¦ 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