NAME
r.grow.shrink - Generates a raster map layer with contiguous areas grown by one cell.
KEYWORDS
raster,
distance
SYNOPSIS
r.grow.shrink
r.grow.shrink --help
r.grow.shrink input=name output=name [radius=float] [metric=string] [old=integer] [new=integer] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
Flags:
- --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
- output=name [required]
- Name for output raster map
- radius=float
- Radius of buffer in raster cells
- Default: 1.01
- metric=string
- Metric
- Options: euclidean, maximum, manhattan
- Default: euclidean
- old=integer
- Value to write for input cells which are non-NULL (-1 => NULL)
- new=integer
- Value to write for "grown" cells
r.grow.shrink adds cells around the perimeters of all areas
in a user-specified raster map layer and stores the output in
a new raster map layer. The user can use it to grow by one or
more than one cell (by varying the size of the
radius
parameter), or like
r.buffer, but with the
option of preserving the original cells (similar to combining
r.buffer and
r.patch).
A negative radius shrinks inwards instead of growing outwards.
The user has the option of specifying three different metrics which
control the geometry in which grown cells are created, (controlled by
the
metric parameter):
Euclidean,
Manhattan, and
Maximum.
The Euclidean distance or Euclidean metric 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 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.
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.
If there are two cells which are equal candidates to grow into an empty space,
r.grow will choose the northernmost candidate; if there are multiple
candidates with the same northing, the westernmost is chosen.
You can shrink inwards by using a negative radius. For example:
# North Carolina sample dataset
g.region raster=lakes
r.grow.shrink in=lakes out=lakes.shrunken radius=-2.01
r.colors lakes.shrunken rast=lakes
r.buffer,
r.grow,
r.grow.distance
r.distance,
r.patch
Wikipedia Entry: Euclidean Metric
Wikipedia Entry: Manhattan Metric
Marjorie Larson,
U.S. Army Construction Engineering Research Laboratory
Glynn Clements
Last changed: $Date: 2014-12-27 14:30:46 +0100 (Sat, 27 Dec 2014) $
SOURCE CODE
Available at: r.grow.shrink source code (history)
Main index |
Raster index |
Topics index |
Keywords index |
Graphical index |
Full index
© 2003-2018
GRASS Development Team,
GRASS GIS 7.4.1svn Reference Manual