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.bufferassumes that0is 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
0as its lower bound. periodt πΈ - buffer distances can be specified using one of five units with the
unitsparameter π
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 ther.buffer.lowmemmodule if RAM use becomes a problem. the lowmem version can be > 40x slower, but will work with minimal memory requirements. the classicr.buffershould be able to deal with raster maps of32000x32000size on a system with1 GB RAM, and rasters of90000x90000on a system with8 GB RAMwithout 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
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· 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