2
############################################################################
5
# AUTHOR: Hamish Bowman
6
# PURPOSE: Add missing centroids (frontend to v.category opt=add)
7
# COPYRIGHT: (c) 2006 Hamish Bowman, and the GRASS Development Team
8
# This program is free software under the GNU General Public
9
# License (>=v2). Read the file COPYING that comes with GRASS
12
#############################################################################
15
#% description: Adds missing centroids to closed boundaries.
16
#% keywords: vector, centroid, area
22
#% gisprompt: old,vector,vector
24
#% description: Name of input vector map
31
#% gisprompt: new,vector,vector
33
#% description: Name for output vector map
40
#% description: Action to be taken
49
#% description: Layer number
50
#% gisprompt: new_layer,layer,layer
58
#% description: Category number starting value
66
#% description: Category increment
72
if [ -z "$GISBASE" ] ; then
73
echo "You must be in GRASS GIS to run this program." 1>&2
77
if [ "$1" != "@ARGS_PARSED@" ] ; then
78
exec g.parser "$0" "$@"
82
if [ "$GIS_OPT_OPTION" = "add" ] ; then
84
# check we have boundaries
85
NUM_BOUND=`v.info -t "$GIS_OPT_INPUT" | grep boundaries | cut -d'=' -f2`
87
if [ $NUM_BOUND -eq 0 ] ; then
88
g.message -e "Input vector map contains no boundaries."
93
v.category input="$GIS_OPT_INPUT" output="$GIS_OPT_OUTPUT" option=add \
94
type=area layer="$GIS_OPT_LAYER" cat="$GIS_OPT_CAT" step="$GIS_OPT_STEP"