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 is euclidean. 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