[GRASS-SVN] r41617 - grass/trunk/raster/r.grow

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


Author: hamish
Date: 2010-03-29 19:17:20 -0400 (Mon, 29 Mar 2010)
New Revision: 41617

Modified:
   grass/trunk/raster/r.grow/r.grow.html
Log:
add shrinking example (#1024)

Modified: grass/trunk/raster/r.grow/r.grow.html
===================================================================
--- grass/trunk/raster/r.grow/r.grow.html	2010-03-29 18:49:17 UTC (rev 41616)
+++ grass/trunk/raster/r.grow/r.grow.html	2010-03-29 23:17:20 UTC (rev 41617)
@@ -9,6 +9,7 @@
 option of preserving the original cells (similar to combining
 <em>r.buffer</em> and <em>r.patch</em>).
 
+
 <h2>NOTES</h2>
 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>.
 
 <p>
-
 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. 
 
 <p>
-
 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.
 
 <p>
-
 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. 
 
+
+<h2>EXAMPLE</h2>
+
+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
+
+MAP=fields
+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
+</pre></div>
+
+
 <h2>SEE ALSO</h2>
-
 <em>
 <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>
 
 <p>
-
 <em><a href="http://en.wikipedia.org/wiki/Euclidean_metric">Wikipedia Entry: Euclidean Metric</a></em><br>
 <em><a href="http://en.wikipedia.org/wiki/Manhattan_metric">Wikipedia Entry: Manhattan Metric</a></em>
 
+
 <h2>AUTHORS</h2>
 
 Marjorie Larson, 
@@ -77,4 +92,5 @@
 <p>
 Glynn Clements
 
-<p><i>Last changed: $Date$</i>
+<p>
+<i>Last changed: $Date$</i>



More information about the grass-commit mailing list