~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to scripts/v.centroids/v.centroids

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
############################################################################
3
 
#
4
 
# MODULE:       v.centroids
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
10
 
#               for details.
11
 
#
12
 
#############################################################################
13
 
 
14
 
#%Module
15
 
#% description: Adds missing centroids to closed boundaries.
16
 
#% keywords: vector, centroid, area
17
 
#%End
18
 
 
19
 
#%option
20
 
#% key: input
21
 
#% type: string
22
 
#% gisprompt: old,vector,vector
23
 
#% key_desc: name
24
 
#% description: Name of input vector map 
25
 
#%required: yes
26
 
#%end
27
 
 
28
 
#%option
29
 
#% key: output
30
 
#% type: string
31
 
#% gisprompt: new,vector,vector
32
 
#% key_desc: name
33
 
#% description: Name for output vector map
34
 
#% required: yes
35
 
#%end
36
 
 
37
 
#%option
38
 
#% key: option
39
 
#% type: string
40
 
#% description: Action to be taken
41
 
#% options: add
42
 
#% answer: add
43
 
#% required: no
44
 
#%end
45
 
 
46
 
#%option
47
 
#% key: layer
48
 
#% type: integer
49
 
#% description: Layer number
50
 
#% gisprompt: new_layer,layer,layer
51
 
#% answer: 1
52
 
#% required: no
53
 
#%end
54
 
 
55
 
#%option
56
 
#% key: cat
57
 
#% type: integer
58
 
#% description: Category number starting value
59
 
#% answer: 1
60
 
#% required: no
61
 
#%end
62
 
 
63
 
#%option
64
 
#% key: step
65
 
#% type: integer
66
 
#% description: Category increment
67
 
#% answer: 1
68
 
#% required: no
69
 
#%end
70
 
 
71
 
 
72
 
if  [ -z "$GISBASE" ] ; then
73
 
    echo "You must be in GRASS GIS to run this program." 1>&2
74
 
    exit 1
75
 
fi
76
 
 
77
 
if [ "$1" != "@ARGS_PARSED@" ] ; then
78
 
    exec g.parser "$0" "$@"
79
 
fi
80
 
 
81
 
 
82
 
if [ "$GIS_OPT_OPTION" = "add" ] ; then
83
 
 
84
 
   # check we have boundaries
85
 
   NUM_BOUND=`v.info -t "$GIS_OPT_INPUT" | grep boundaries | cut -d'=' -f2`
86
 
 
87
 
   if [ $NUM_BOUND -eq 0 ] ; then
88
 
       g.message -e "Input vector map contains no boundaries."
89
 
       exit 1
90
 
   fi
91
 
 
92
 
   # add centroids
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"
95
 
 
96
 
   exit $?
97
 
fi
98
 
 
99
 
exit 0