r.grow.distance(1grass)
π r.grow.distance π
okay bestie, welcome to r.grow.distance, a GRASS User's Manual moment brought to you by the letter "d" for distance π¦ this one's a raster module, and it's lowkey iconic.
β¨ NAME β¨
r.grow.distance β generates a raster map containing distances to nearest raster features and/or the value of the nearest non-null cell. π
π KEYWORDS π
raster, distance, proximity β that's the vibe check right there β¨
πΈ 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]
π Flags
-mβ outputs distances in meters instead of map units, slay π-nβ calculates distance to the nearest NULL cell instead--overwriteβ lets output files overwrite files that already exist, no hesitation--helpβ prints the usage summary for u--verboseβ verbose module output, she's chatty--quietβ quiet module output, she's mysterious--uiβ forces the GUI dialog to launch π«Ά
π Parameters
input=name[required] β name of the input raster map. not optional, bestie, she NEEDS it.distance=nameβ name for the distance output raster mapvalue=nameβ name for the value output raster mapmetric=stringβ the metric π§- Options:
euclidean,squared,maximum,manhattan,geodesic - Default:
euclidean
- Options:
minimum_distance=floatβ minimum distance thresholdmaximum_distance=floatβ maximum distance threshold
π« DESCRIPTION π«
r.grow.distance generates raster maps representing the distance to the nearest non-null cell in the input map and/or the value of the nearest non-null cell. that's literally the whole job and she does it flawlessly β¨
π NOTES π
the -n flag calculates the respective pixel distances to the nearest NULL cell. noted. π
you, the user, get to pick from five different metrics, and they control the geometry in which grown cells are created (this is all controlled by the metric parameter): Euclidean, Squared, Manhattan, Maximum, and Geodesic. five options, five vibes, choose wisely π
the Euclidean distance, aka the Euclidean metric, is the "ordinary" distance between two points that you'd measure with a ruler β and yes, it can be proven by repeated application of the Pythagorean theorem. the formula is given by:
d(dx,dy) = sqrt(dx^2 + dy^2)
cells grown using this metric would form isolines of distance that are circular from a given point, with the distance given by the radius. it's giving perfect circles, we love to see it β
the Squared metric is the Euclidean distance squared, i.e. it simply omits the square-root calculation. this may be faster, and it's sufficient if you only need relative values. no square root, no problem π
the Manhattan metric, or Taxicab geometry, is a form of geometry in which the usual metric of Euclidean geometry is replaced by a new metric in which the distance between two points is the sum of the (absolute) differences of their coordinates. the name alludes to the grid layout of most streets on the island of Manhattan, which causes the shortest path a car could take between two points in the city to have length equal to the points' distance in taxicab geometry. π the formula is given by:
d(dx,dy) = abs(dx) + abs(dy)
where cells grown using this metric would form isolines of distance that are rhombus-shaped from a given point. rhombus era π
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. squares!! β¬
the Geodesic metric is calculated as geodesic distance, and it's to be used only in a latitude-longitude coordinate reference system. it's recommended to use it along with the -m flag in order to output distances in meters instead of map units. π
if minimum_distance is given, all cells with a distance smaller than minimum_distance will be set to NULL. gone, poof, bye π
if maximum_distance is given, all cells with a distance larger than maximum_distance will be set to NULL. the resultant 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 π© β and all cells outside this distance range will be set to NULL.
π 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
π AUTHOR π
Glynn Clements β king behaviour, honestly π
π¦ SOURCE CODE π¦
Available at: r.grow.distance source code (history)
Latest change: Saturday Oct 25 22:50:58 2025 in commit: ee87f21833475fd40805f58d1702f7d64478a27b
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
okay that's the whole page bestie, no cap π«Ά one last thing before u go β this came from the r.grow.distance(1grass) page, the last touch was Saturday Oct 25 22:50:58 2025, and it's all copyrighted Β© 2003-2026 GRASS Development Team under GRASS 8.5.0 Reference Manual. periodt. π
β¨π
π¦ 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