logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

r.grow.distance - Generates a raster map containing distances to nearest raster features and/or the

Author

       Glynn Clements

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.

Examples

Distancefromthestreamsnetwork
       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
       Euclideandistancefromthestreamsnetworkinmeters(mapsubset)Euclideandistancefromthestreamsnetworkinmeters(detail,numbersshownwithd.rast.num)Distancefromseainmetersinlatitude-longitudeCRS
       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

       Geodesicdistancestoseainmeters

Keywords

       raster, distance, proximity

Name

r.grow.distance   -  Generates  a  raster  map containing distances to nearest raster features and/or the
       value of the nearest non-null cell.

Notes

       The flag -n calculates 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  the metric parameter): Euclidean, Squared, Manhattan, Maximum, and
       Geodesic.

       The Euclideandistance or Euclideanmetric is 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 the radius.

       The  Squared  metric is the Euclidean distance squared, i.e. it simply omits the square-root calculation.
       This may be faster, and is sufficient if only relative values are required.

       The Manhattanmetric, or Taxicabgeometry, 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.

       The Maximummetric is given by the formula
       d(dx,dy) = max(abs(dx),abs(dy))
       where the isolines of distance from a point are squares.

       The  Geodesicmetric is calculated as geodesic distance, to be used only in latitude-longitude coordinate
       reference system. It is 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.

       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. All cells outside this distance range will be set to NULL.

See Also

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

Source Code

       Available at: r.grow.distance source code (history)

       Accessed: Friday Apr 04 01:19:09 2025

       Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

       © 2003-2025 GRASS Development Team, GRASS GIS 8.4.1 Reference Manual

GRASS 8.4.1                                                                              r.grow.distance(1grass)

Synopsis

r.grow.distancer.grow.distance--helpr.grow.distance     [-mn]     input=name       [distance=name]        [value=name]        [metric=string]
       [minimum_distance=float]    [maximum_distance=float]    [--overwrite]   [--help]   [--verbose]  [--quiet]
       [--ui]

   Flags:-m
           Output distances in meters instead of map units

       -n
           Calculate distance to nearest NULL cell

       --overwrite
           Allow output files to overwrite existing files

       --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

       distance=name
           Name for distance output raster map

       value=name
           Name for value output raster map

       metric=string
           Metric
           Options: euclidean,squared,maximum,manhattan,geodesic
           Default: euclideanminimum_distance=float
           Minimum distance threshold

       maximum_distance=float
           Maximum distance threshold

See Also