GRASS 5.7: Some vector API docs
Tutorial HOME |
Table of contents
GRASS 5.7 is currently under development. In case the examples described here do
not work properly, you are kindly invited to send us further examples and/or
Why is the 5.7 vector engine faster than 5.0?
One reason is that the 'cat's are stored in the geometry file now (in 5.0 it
was in a separate file), the second reason is the use of a spatial index.
What is this 'field' thing?
The field is used to link one or several attribute tables to a vector map.
Per default field=1 for each vector line: link to table 1. But it is
possible that each vector has a different field value, so that
various lines in a vector map link to different tables (through the 'dbln'
When digitizing with 'v.digit' the field can be set for each vector.
The normal user will not care about 'field'.
Vector data 'dbln' file mechanism
The "normal" user does not have to care about this file (it is usually
generated automatically or can be written with 'v.db.connect').
The following text describes some API internals.
Each vector element may have none, one or more categories (cats). If many
cats are required, they are distinguished by different field numbers
(field). Records in a vector attribute table are linked to vector entities
by field and category number. The field number identifies a database table
and the category number identifies the table record. I.e. for unique
combination mapset + map + field + category exists one unique
combination driver + database + table + row.
When a definition defines more fields for one map i.e. in one
map the same vector features are linked to several attribute tables.
For each pair field must be defined table, key column, database,
driver. This definition must be written to $MAPSET/vector/MAP/dbln
text file. Each row in dbln file contains names separated by spaces
in following order ( - optional):
field table [key [database [driver]]]
If key, database or driver are omited (on second and higher row only) last
definition is used.
Wild cards * and ? may be used. Variables GISDBASE, $LOCATION, $FIELD may
be used in table, key, database and driver names.
Normally the dbln file is generated by GRASS.
The SHAPE driver does not use the dbln file.
Default vector data storage settings
Default settings are defined in the file
If there is a 'dbln' file present for a vector map, it is used.
If a new map is generated, the VAR settings are used.
Differences between DBF and SHAPE driver
In contrast to the DBF driver the SHAPE driver provides on-the-fly a
virtual column 'shp_id'.
Further Links (related software, SQL reference etc).