1v.category(1)                 Grass User's Manual                v.category(1)
2
3
4

NAME

6       v.category   -  Attaches,  deletes  or reports vector categories to map
7       geometry.
8

KEYWORDS

10       vector, category, layer
11

SYNOPSIS

13       v.category
14       v.category --help
15       v.category      [-gt]      input=name       [layer=string[,string,...]]
16       [type=string[,string,...]]   [ids=range]   [output=name]  option=string
17       [cat=integer]   [step=integer]   [--overwrite]   [--help]   [--verbose]
18       [--quiet]  [--ui]
19
20   Flags:
21       -g
22           Shell script style, currently only for report
23           Format: layer type count min max
24
25       -t
26           Do not copy attribute table(s)
27
28       --overwrite
29           Allow output files to overwrite existing files
30
31       --help
32           Print usage summary
33
34       --verbose
35           Verbose module output
36
37       --quiet
38           Quiet module output
39
40       --ui
41           Force launching GUI dialog
42
43   Parameters:
44       input=name [required]
45           Name of input vector map
46           Or data source for direct OGR access
47
48       layer=string[,string,...]
49           Layer number or name
50           Vector  features can have category values in different layers. This
51           number determines which layer to use. When  used  with  direct  OGR
52           access this is the layer name.
53           Default: 1
54
55       type=string[,string,...]
56           Input feature type
57           Options: point, line, boundary, centroid, area, face, kernel
58           Default: point,line,centroid,face
59
60       ids=range
61           Feature ids (by default all features are processed)
62           Example: 1,3,7-9,13
63
64       output=name
65           Name for output vector map
66
67       option=string [required]
68           Action to be done
69           Options: add, del, chlayer, sum, report, print, layers, transfer
70           add: add a category to features without category in the given layer
71           del:  delete  category  (cat=-1  to  delete all categories of given
72           layer)
73           chlayer: change layer number (e.g. layer=3,1  changes  layer  3  to
74           layer 1)
75           sum:  add the value specified by cat option to the current category
76           value
77           report: print report (statistics), in shell style: layer type count
78           min max
79           print:  print  category  values,  layers are separated by ’|’, more
80           cats in the same layer are separated by ’/’
81           layers: print only layer numbers
82           transfer: copy values from one layer to another  (e.g.  layer=1,2,3
83           copies values from layer 1 to layer 2 and 3)
84
85       cat=integer
86           Category value
87           Default: 1
88
89       step=integer
90           Category increment
91           Default: 1
92

DESCRIPTION

94       v.category  attaches,  copies,  deletes or reports categories of vector
95       geometry objects. Further on, v.category adds a number given by the cat
96       option to categories of the selected layer.  These categories (IDs) are
97       used to assign IDs or to group geometry objects into  categories  (sev‐
98       eral  different  geometry objects share the same category). These cate‐
99       gories are also used to link geometry object(s)  to  attribute  records
100       (from an attribute table linked to vector map).
101

NOTES

103       Use v.to.db to upload related categories to a linked attribute table.
104
105       The  type parameter specifies the type of geometry objects to which the
106       category is added; it is similar to an input filter - only the geometry
107       specified in ’type’ is processed.
108
109       If  the  type parameter is set to centroid and the option parameter set
110       to add, new categories will be added to existing centroids.  Note  how‐
111       ever,  that  new  centroids cannot be created this way.  To do so, they
112       must be added manually using  wxGUI  vector  digitizer  or  by  running
113       v.category with the type parameter set to area.
114
115       If  categories  are copied with option=transfer, a warning is issued if
116       categories already exit in the layer they are copied to. In  this  case
117       the  user  must  make  sure beforehand that copying categories from one
118       layer to another layer does not cause undesired grouping  of  different
119       geometry objects into the same categories. This can be avoided by spec‐
120       ifying only one layer. The module will then find the  next  free  layer
121       number  and  copy categories to there. The new layer number is reported
122       at the end.
123
124       Areas are a special case because it is impossible to attach a cat to an
125       area  without a centroid; in this case, the module places new centroids
126       in areas automatically for type=area.
127
128       The  cat  parameter  is  only  used  with  option=add,  option=sum  and
129       option=del.
130
131       Categories  can be deleted for the given layer with option=del.  If cat
132       is set to -1, all categories for the given layer are deleted. If cat is
133       zero or positive, only this category value will be deleted. By default,
134       cat is set to 1 which means that only categories of  value  1  will  be
135       deleted.
136
137       With  option=report,  the  module  reports  for each layer and type the
138       total number of categories, the minimum and the maximum  category  num‐
139       ber. If there are e.g. two lines with line 1 having category 1 and line
140       1 having categories 1 and 2, then there are a total of  three  category
141       values with minimum 1 and maximum 2.
142
143       The ids parameter specifies the list of feature IDs to which the opera‐
144       tion is performed; by default, all vector feature  ids  are  processed.
145       The  feature  ID  is  an  internal (unique) geometry ID that all vector
146       primitives possess, and is separate from any category the  feature  may
147       also possess.  Use
148         v.edit map=inputname tool=select
149       to find out the geometry ids of certain features.
150

EXAMPLES

152   Report vector categories
153       v.category input=testmap option=report
154       LAYER/TABLE 1/testmap:
155       type       count        min        max
156       point          0          0          0
157       line        1379          1       1379
158       boundary       0          0          0
159       centroid       0          0          0
160       area           0          0          0
161       all         1379          1       1379
162
163   Delete all vector categories in layer 1
164       v.category input=testmap output=outmap option=del cat=-1
165
166   Add vector categories in layer 1 with step=2
167       v.category input=outmap output=stepmap option=add step=2
168       # report
169       v.category input=stepmap option=report
170       LAYER/TABLE 1/outmap:
171       type       count        min        max
172       point          0          0          0
173       line        1379          1       2757
174       boundary       0          0          0
175       centroid       0          0          0
176       area           0          0          0
177       all         1379          1       2757
178
179   Add categories/centroids to a vector map without categories
180       v.category input=wkt output=wktnew option=add
181       Results can be tested using d.what.vect.
182
183   Copy categories from layer 1 to layer 2,3,4,5,6,7 and 8
184       Existing layer will be overwritten, non-existing will be created.
185       v.category input=observer output=observer_new option=transfer layer=1,2,3,4,5,6,7,8
186
187   Print vector categories of given layer
188       Print  vector  categories  from  the  first layer, only for feature ids
189       1-50.
190       v.category input=roads option=print layer=1 id=1-50
191

SEE ALSO

193        v.centroids, v.db.connect, v.edit, v.to.db
194

AUTHOR

196       Radim Blazek, ITC-irst, Trento, Italy
197       Modified  (the  id  parameter)  by  Martin  Landa,  FBK-irst  (formerly
198       ITC-irst), Trento, Italy, 2008/02
199

SOURCE CODE

201       Available at: v.category source code (history)
202
203       Main  index  | Vector index | Topics index | Keywords index | Graphical
204       index | Full index
205
206       © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
207
208
209
210GRASS 7.8.2                                                      v.category(1)
Impressum