2
############################################################################
4
# MODULE: v.type_wrapper.py (v.type wrapper script)
6
# AUTHOR(S): Hamish Bowman (Otago University, New Zealand)
7
# (original contributor, v.type.sh)
8
# Pythonized by Martin Landa <landa.martin gmail.com> (2008/08)
10
# PURPOSE: Supply v.type options in a GUI compatible way
12
# COPYRIGHT: (C) 2007-2008 by Hamish Bowman, and the GRASS Development Team
14
# This program is free software under the GNU General Public
15
# License (>=v2). Read the file COPYING that comes with GRASS
18
#############################################################################
21
#% description: Change the type of geometry elements.
22
#% keywords: vector, geometry
31
#% description: Name of input vector map
32
#% gisprompt: old,vector,vector
41
#% description: Name for output vector map
42
#% gisprompt: new,vector,vector
50
#% options: point to centroid,point to kernel,centroid to point,centroid to kernel,kernel to point,kernel to centroid,line to boundary,line to face,boundary to line,boundary to face,face to line,face to boundary
51
#% description: Conversion
52
#% answer: boundary to line
56
from grass.script import core as grass
59
if options['type'] == "point to centroid":
60
type_cnv = "point,centroid"
61
elif options['type'] == "point to kernel":
62
type_cnv = "point,kernel"
63
elif options['type'] == "centroid to point":
64
type_cnv = "centroid,point"
65
elif options['type'] == "centroid to kernel":
66
type_cnv = "centroid,kernel"
67
elif options['type'] == "kernel to point":
68
type_cnv = "kernel,point"
69
elif options['type'] == "kernel to centroid":
70
type_cnv = "kernel,centroid"
71
elif options['type'] == "line to boundary":
72
type_cnv = "line,boundary"
73
elif options['type'] == "line to face":
74
type_cnv = "line,face"
75
elif options['type'] == "boundary to line":
76
type_cnv = "boundary,line"
77
elif options['type'] == "boundary to face":
78
type_cnv = "boundary,face"
79
elif options['type'] == "face to line":
80
type_cnv = "face,line"
81
elif options['type'] == "face to boundary":
82
type_cnv = "face,boundary"
85
grass.exec_command("v.type", type = type_cnv, **options)
89
if __name__ == "__main__":
90
options, flags = grass.parser()