r.grow.distance(1)
π r.grow.distance β the GRASS GIS User's Manual glow-up π
okay bestie, sit down, hydrate, because we're talking about r.grow.distance from the GRASS GIS User's Manual (that's the r.grow.distance(1) page, manifesting for you in GRASS 8.4.2) π«Ά
β¨ NAME β¨
r.grow.distance β it makes a raster map with the distances to the nearest raster features, and/or the value of the nearest non-null cell. that's the whole personality. π
π·οΈ KEYWORDS π·οΈ
raster, distance, proximity β the holy trinity, no cap π
π¦ SYNOPSIS π¦
r.grow.distance
r.grow.distance --help
r.grow.distance [-mn] input=name [distance=name] [value=name]
[metric=string] [minimum_distance=float] [maximum_distance=float]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
like... it's giving "here's every possible way to call me" and honestly? iconic π
π Flags π
-mβ output those distances in meters instead of map units. metric system girlies rise π§-nβ calculate the distance to the nearest NULL cell instead. plot twist era π--overwriteβ let the output files bulldoze any existing files that are already sitting there. permission to be messy granted β¨--helpβ prints the usage summary. the "explain it to me like I'm five" button π--verboseβ verbose module output. she will NOT stop talking and we love her for it π£οΈ--quietβ quiet module output. the silent treatment, but productive π€«--uiβ forces the GUI dialog to launch. main character GUI energy π₯οΈ
πΈ Parameters πΈ
input=nameβ required, bestie, you literally cannot skip this one. it's the name of the input raster map. πdistance=nameβ the name you want for the distance output raster map.value=nameβ the name you want for the value output raster map.metric=stringβ the metric. options are:euclidean,squared,maximum,manhattan,geodesic. default iseuclidean. pick your fighter π₯minimum_distance=floatβ minimum distance threshold.maximum_distance=floatβ maximum distance threshold.
π« DESCRIPTION π«
r.grow.distance generates raster maps that represent the distance to the nearest non-null cell in the input map, and/or the value of the nearest non-null cell. that's it, that's the job, and she does it flawlessly π«‘
π₯ NOTES π₯
the -n flag calculates the respective pixel distances to the nearest NULL cell. π
you, the user, get to pick from five different metrics that control the geometry of how the grown cells get created β all controlled by the metric parameter: Euclidean, Squared, Manhattan, Maximum, and Geodesic. five flavors, one icon π
The Euclidean distance, a.k.a. the Euclidean metric, is the "ordinary" distance between two points β the kind you'd measure with an actual ruler, and yes you can prove it by repeatedly applying the Pythagorean theorem, math bestie. the formula is:
d(dx,dy) = sqrt(dx^2 + dy^2)
cells grown with this metric form isolines of distance that are circular from a given point, with the distance given by the radius. cute, round, perfect. β
The Squared metric is the Euclidean distance squared β meaning it simply skips the square-root calculation. this may be faster, and it's totally sufficient if you only need relative values. speed over precision, we respect the hustle β‘
The Manhattan metric, a.k.a. Taxicab geometry, is a form of geometry where the usual Euclidean metric gets swapped out for a new one where the distance between two points is the sum of the (absolute) differences of their coordinates. the name is a whole shoutout to the grid layout of most streets on the island of Manhattan β which makes the shortest path a car could take between two points in the city have a length equal to the points' distance in taxicab geometry. the formula is:
d(dx,dy) = abs(dx) + abs(dy)
and cells grown with this metric form isolines of distance that are rhombus-shaped from a given point. diamond vibes π
The Maximum metric is given by the formula:
d(dx,dy) = max(abs(dx),abs(dy))
where the isolines of distance from a point are squares. β¬
The Geodesic metric is calculated as geodesic distance, and it should be used only in a latitude-longitude coordinate reference system. it's recommended to use it together with the -m flag so you output distances in meters instead of map units. π
if minimum_distance is given, all cells with a distance smaller than minimum_distance get set to NULL.
if maximum_distance is given, all cells with a distance larger than maximum_distance get set to NULL. the resulting output is equivalent to a buffer.
if both minimum_distance and maximum_distance are given, the result will be similar to a doughnut β a restricted belt for a given distance range. all cells outside that distance range get set to NULL. π© periodt.
π EXAMPLES π
ποΈ Distance from the streams network
North Carolina sample dataset:
g.region raster=streams_derived -p
r.grow.distance input=streams_derived distance=dist_from_streams
r.colors map=dist_from_streams color=rainbow
Euclidean distance from the streams network in meters (map subset)
Euclidean distance from the streams network in meters (detail, numbers shown with d.rast.num)
π Distance from sea in meters in latitude-longitude CRS
g.region raster=sea -p
r.grow.distance -m input=sea distance=dist_from_sea_geodetic metric=geodesic
r.colors map=dist_from_sea_geodetic color=rainbow
Geodesic distances to sea in meters π
π SEE ALSO π
r.grow,r.distance,r.buffer,r.cost,r.patch- Wikipedia Entry: Euclidean Metric
- Wikipedia Entry: Manhattan Metric
go read, bestie, it's giving β¨knowledgeβ¨
π AUTHOR π
Glynn Clements β thank you for your service, legend π«‘
π¦ SOURCE CODE π¦
Available at: r.grow.distance 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 manual is from the GRASS GIS 8.4.2 Reference Manual, Β© 2003-2025 GRASS Development Team, running under GRASS 8.4.2 β and the accessed date on the source code? Saturday Jan 17 05:40:46 2026. yeah, she's from the future. π β¨π¦
go grow some distances. you got this. slay π
π¦ 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