Provided by: grass-doc_7.6.0-1_all

**NAME**

r.grow.distance- Generates a raster map containing distances to nearest raster features.

**KEYWORDS**

raster, distance, proximity

**SYNOPSIS**

r.grow.distancer.grow.distance--helpr.grow.distance[-mn]input=name[distance=name] [value=name] [metric=string] [--overwrite] [--help] [--verbose] [--quiet] [--ui]Flags:-mOutput distances in meters instead of map units-nCalculate distance to nearest NULL cell--overwriteAllow output files to overwrite existing files--helpPrint usage summary--verboseVerbose module output--quietQuiet module output--uiForce launching GUI dialogParameters:input=name[required]Name of input raster mapdistance=nameName for distance output raster mapvalue=nameName for value output raster mapmetric=stringMetric Options:euclidean,squared,maximum,manhattan,geodesicDefault:euclidean

**DESCRIPTION**

r.grow.distancegenerates 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.

**NOTES**

The flag-ncalculates the respective pixel distances to the nearest NULL cell. The user has the option of specifying five different metrics which control the geometry in which grown cells are created, (controlled by themetricparameter):Euclidean,Squared,Manhattan,Maximum, andGeodesic. TheEuclideandistanceorEuclideanmetricis the "ordinary" distance between two points that one would measure with a ruler, which 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 theradius. TheSquaredmetric is theEuclideandistance squared, i.e. it simply omits the square-root calculation. This may be faster, and is sufficient if only relative values are required. TheManhattanmetric, orTaxicabgeometry, 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. TheMaximummetricis given by the formula d(dx,dy) = max(abs(dx),abs(dy)) where the isolines of distance from a point are squares. TheGeodesicmetricis calculated as geodesic distance, to be used only in latitude-longitude locations. It is recommended to use it along with the-mflag in order to output distances in meters instead of map units.

**EXAMPLES**

DistancefromthestreamsnetworkNorth Carolina sample dataset: g.region raster=streams_derived -p r.grow.distance input=streams_derived distance=dist_from_streamsEuclideandistancefromthestreamsnetworkinmeters(mapsubset)Euclideandistancefromthestreamsnetworkinmeters(detail,numbersshownwithd.rast.num)Distancefromseainmetersinlatitude-longitudelocationg.region raster=sea -p r.grow.distance -m input=sea distance=dist_from_sea_geodetic metric=geodesicGeodesicdistancestoseainmeters

**SEE** **ALSO**

r.grow,r.distance,r.buffer,r.cost,r.patchWikipediaEntry:EuclideanMetricWikipediaEntry:ManhattanMetric

**AUTHORS**

Glynn ClementsLastchanged:$Date:2016-01-2114:23:39+0100(Thu,21Jan2016)$

**SOURCE** **CODE**

Available at: r.grow.distance source code (history) Main index | Raster index | Topics index | Keywords index | Graphical index | Full index © 2003-2019 GRASS Development Team, GRASS GIS 7.6.0 Reference Manual