[GRASS-SVN] r41618 - grass/branches/develbranch_6/raster/r.grow2

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 29 19:21:33 EDT 2010

Author: hamish
Date: 2010-03-29 19:21:33 -0400 (Mon, 29 Mar 2010)
New Revision: 41618

add shrinking example (#1024, merge from trunk)

Modified: grass/branches/develbranch_6/raster/r.grow2/description.html
--- grass/branches/develbranch_6/raster/r.grow2/description.html	2010-03-29 23:17:20 UTC (rev 41617)
+++ grass/branches/develbranch_6/raster/r.grow2/description.html	2010-03-29 23:21:33 UTC (rev 41618)
@@ -9,6 +9,7 @@
 option of preserving the original cells (similar to combining
 <em>r.buffer</em> and <em>r.patch</em>).
 The user has the option of specifying three different metrics which
 control the geometry in which grown cells are created, (controlled by
@@ -28,7 +29,6 @@
 circular from a given point, with the distance given by the <b>radius</b>.
 The <i>Manhattan metric</i>, or <i>Taxicab geometry</i>, 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) 
@@ -44,7 +44,6 @@
 rhombus-shaped from a given point. 
 The <i>Maximum metric</i> is given by the formula
 <div class="code"><pre>d(dx,dy) = max(abs(dx),abs(dy))</pre></div>
@@ -52,13 +51,29 @@
 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, 
 <em>r.grow</em> will choose the northernmost candidate; if there are multiple 
 candidates with the same northing, the westernmost is chosen. 
+You can shrink inwards by preparing an inverse map first, and then
+inverting the resulting grown map. For example:
+<div class="code"><pre>
+# Spearfish sample dataset
+g.region rast=$MAP
+r.mapcalc "inverse = if(isnull($MAP), 1, null())"
+r.grow in=inverse out=inverse.grown
+r.mapcalc "$MAP.shrunken = if(isnull(inverse.grown), $MAP, null())"
+r.colors $MAP.shrunken rast=$MAP
+g.remove inverse,inverse.grown
 <h2>SEE ALSO</h2>
 <a href="r.buffer.html">r.buffer</a>,<br>
 <a href="r.grow.distance.html">r.grow.distance</a>,<br>
@@ -66,10 +81,10 @@
 <em><a href="http://en.wikipedia.org/wiki/Euclidean_metric">Wikipedia Entry: Euclidean Metric</a><br>
 <em><a href="http://en.wikipedia.org/wiki/Manhattan_metric">Wikipedia Entry: Manhattan Metric</a>
 Marjorie Larson, 
@@ -77,4 +92,5 @@
 Glynn Clements
-<p><i>Last changed: $Date$</i>
+<i>Last changed: $Date$</i>

More information about the grass-commit mailing list