[GRASS-SVN] r55843 - in grass-addons/grass6/general: . g.region.grow

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 17 01:54:00 PDT 2013


Author: hamish
Date: 2013-04-17 01:54:00 -0700 (Wed, 17 Apr 2013)
New Revision: 55843

Added:
   grass-addons/grass6/general/g.region.grow/
   grass-addons/grass6/general/g.region.grow/Makefile
   grass-addons/grass6/general/g.region.grow/description.html
   grass-addons/grass6/general/g.region.grow/g.region.grow
Log:
+ wrapper script to grow (or shrink) region in all directions by a fixed amount

Copied: grass-addons/grass6/general/g.region.grow/Makefile (from rev 55245, grass-addons/grass6/general/g.region.point/Makefile)
===================================================================
--- grass-addons/grass6/general/g.region.grow/Makefile	                        (rev 0)
+++ grass-addons/grass6/general/g.region.grow/Makefile	2013-04-17 08:54:00 UTC (rev 55843)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = g.region.grow
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script

Added: grass-addons/grass6/general/g.region.grow/description.html
===================================================================
--- grass-addons/grass6/general/g.region.grow/description.html	                        (rev 0)
+++ grass-addons/grass6/general/g.region.grow/description.html	2013-04-17 08:54:00 UTC (rev 55843)
@@ -0,0 +1,34 @@
+<h2>DESCRIPTION</h2>
+
+<em>g.region.grow</em> expands or contracts the current region bounds by
+a fixed amount in all four cardinal directions.
+
+
+<h2>NOTES</h2>
+
+Units are the current location's map units. Negative values for the
+<b>expand</b> option cause the region to be shrunk by that amount
+instead of grown. Options follow the usage of the <em>g.region</em>
+module, see its help page for information about usage of the flags.
+
+
+<h2>EXAMPLE</h2>
+
+<div class="code"><pre>
+g.region.grow -p expand=-10
+</pre></div>
+
+
+<h2>SEE ALSO</h2>
+<em>
+<a href="g.region.html">g.region</a>
+</em><br>
+
+
+<h2>AUTHOR</h2>
+
+Hamish Bowman, Dunedin, New Zealand
+<br>
+
+<p>
+<i>Last changed: $Date$</i>


Property changes on: grass-addons/grass6/general/g.region.grow/description.html
___________________________________________________________________
Added: svn:mime-type
   + text/html
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Added: grass-addons/grass6/general/g.region.grow/g.region.grow
===================================================================
--- grass-addons/grass6/general/g.region.grow/g.region.grow	                        (rev 0)
+++ grass-addons/grass6/general/g.region.grow/g.region.grow	2013-04-17 08:54:00 UTC (rev 55843)
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+############################################################################
+#
+# MODULE:       g.region.grow
+# AUTHOR(S):    Hamish Bowman, Dunedin, New Zealand
+# PURPOSE:      Grow (or shrink) the current region in all directions
+#		 by a set amount.
+# COPYRIGHT:    (C) 2013 Hamish Bowman, and the GRASS Development Team
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+############################################################################
+#%Module
+#% description: Expands (or contracts) the current geographic region in all directions by a fixed amount.
+#% keywords: general, region
+#%End
+#%option
+#%  key: expand
+#%  type: double
+#%  label: Amount to expand the region by
+#%  description: Negative values shrink the region instead.
+#%  required: yes
+#%end
+#%Flag
+#% key: a
+#% description: Align region to resolution (default = align to bounds)
+#%End
+#%Flag
+#% key: p
+#% description: Print the resulting region
+#%End
+#%Flag
+#% key: g
+#% description: Print the resulting region in shell script style
+#%End
+
+if [ -z "$GISBASE" ] ; then
+    echo "You must be in GRASS GIS to run this program." 1>&2
+    exit 1
+fi
+
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+    exec g.parser "$0" "$@"
+fi
+
+if [ "$GIS_FLAG_A" -eq 1 ] ; then
+    eval `g.region -g`
+    ALIGN_FLAG="-a ewres=$ewres nsres=$nsres"
+else
+    ALIGN_FLAG=""
+fi
+
+if [ "$GIS_FLAG_P" -eq 1 ] ; then
+    PRINT_FLAG="-p"
+else
+    PRINT_FLAG=""
+fi
+
+if [ "$GIS_FLAG_G" -eq 1 ] ; then
+    SHELL_FLAG="-g"
+else
+    SHELL_FLAG=""
+fi
+
+SIGN=`echo "$GIS_OPT_EXPAND" | cut -c1`
+ABSVAL=`echo "$GIS_OPT_EXPAND" | sed -e 's/^-//'`
+
+if [ "$SIGN" = "-" ] ; then
+    g.region $ALIGN_FLAG $PRINT_FLAG $SHELL_FLAG \
+       n=n-"$ABSVAL" s=s+"$ABSVAL" w=w+"$ABSVAL" e=e-"$ABSVAL"
+else
+    g.region $ALIGN_FLAG $PRINT_FLAG $SHELL_FLAG \
+       n=n+"$ABSVAL" s=s-"$ABSVAL" w=w-"$ABSVAL" e=e+"$ABSVAL"
+fi
+


Property changes on: grass-addons/grass6/general/g.region.grow/g.region.grow
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/x-sh
Added: svn:eol-style
   + native



More information about the grass-commit mailing list