GRASS logo

Note: A new GRASS GIS stable version has been released: GRASS GIS 7, available here. And see the new manual page here

NAME

v.category - Attach, delete or report vector categories to map geometry.

KEYWORDS

vector, category

SYNOPSIS

v.category
v.category help
v.category [-g] input=name [output=name] [option=string] [type=string[,string,...]] [layer=integer[,integer,...]] [ids=range] [cat=integer] [step=integer] [--overwrite] [--verbose] [--quiet]

Flags:

-g
Shell script style, currently only for report
Format: layer type count min max
--overwrite
Allow output files to overwrite existing files
--verbose
Verbose module output
--quiet
Quiet module output

Parameters:

input=name
Name of input vector map
output=name
Name for output vector map
option=string
Action to be done
Options: add,del,chlayer,sum,report,print,layers
Default: add
add: add a category to features without category in the given layer
del: delete all categories of given layer
chlayer: change layer number (e.g. layer=3,1 changes layer 3 to layer 1)
sum: add the value specified by cat option to the current category value
report: print report (statistics), in shell style: layer type count min max
print: print category values, more cats in the same layer are separated by '/'
layers: print only layer numbers
type=string[,string,...]
Feature type
Options: point,line,boundary,centroid,area
Default: point,line,boundary,centroid,area
layer=integer[,integer,...]
Layer number
A single vector map can be connected to multiple database tables. This number determines which table to use.
Default: 1
ids=range
Feature ids (by default all features are processed)
Example: 1,3,7-9,13
cat=integer
Category value
Default: 1
step=integer
Category increment
Default: 1

DESCRIPTION

v.category attaches, deletes or reports vector categories to map geometry. These categories (IDs) are used to link geometry object(s) to attribute records (from attribute table linked to vector map).

NOTES

Use v.to.db to upload related categories to a linked attribute table.

The type parameter specifies the type of geometry objects to which the category is added; it is similar to an input filter - only the geometry specified in 'type' is processed.

If the type parameter is set to centroid and the option parameter set to add, new categories will be added to existing centroids. Note however, that new centroids cannot be created this way. To do so, they must be added manually using v.digit or by running v.category with the type parameter set to area.

Areas are a special case because it is impossible to attach a cat to an area without a centroid; in this case, the module places new centroids in areas automatically.

The cat parameter is only used with option=add and option=sum.

The ids parameter specifies the list of feature IDs to which the operation is performed; by default, all vector feature ids are processed. The feature ID is an internal (unique) geometry ID that all vector primitives possess, and is separate from any category the feature may also possess. Use

  v.edit map=inputname tool=select
to find out the geometry ids of certain features.

EXAMPLES

Report vector categories

v.category input=testmap option=report

LAYER/TABLE 1/testmap:
type       count        min        max
point          0          0          0
line        1379          1       1379
boundary       0          0          0
centroid       0          0          0
area           0          0          0
all         1379          1       1379

Delete all vector categories in layer 1

v.category input=testmap output=outmap option=del

Add vector categories in layer 1 with step=2

v.category input=outmap output=stepmap option=add step=2

# report
v.category input=stepmap option=report
LAYER/TABLE 1/outmap:
type       count        min        max
point          0          0          0
line        1379          1       2757
boundary       0          0          0
centroid       0          0          0
area           0          0          0
all         1379          1       2757

Add categories/centroids to a vector map without categories

v.category input=wkt output=wktnew option=add
Results can be tested using d.what.vect.

Print vector categories of given layer

Print vector categories from the first layer, only for feature ids 1-50.
v.category input=roads option=print layer=1 id=1-50

SEE ALSO

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

AUTHOR

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

Last changed: $Date: 2011-11-08 01:42:51 -0800 (Tue, 08 Nov 2011) $


Main index - vector index - Full index

© 2003-2016 GRASS Development Team