[GRASS-user] v.db.* commands in GRASS-7

Andres Kuusk andres at aai.ee
Thu Apr 12 06:29:57 EDT 2012



Hi!

It seems to me that some v.db.* modules do not do what is described in the
manual.

I am using GRASS-7.0 r51370 and Postgres data base.

In the manual I read: It is possible to link the geographic objects in a
vector map to one or more tables.
All vector objects are kept in one geometry file, and topology is
maintained for all vector objects together. GRASS layers only consist of
links to different attribute tables in which vector objects can have zero,
one or more categories.

I link two attribute tables to a vector of area polygons.
In layer 1 I see area polygons and I can use selection with where
conditions on the attribute table 1.

In layer 2 the same polylines are boundaries and selection in the
attribute table 2 does not work. Maybe I am doing something wrong?


Another problem.
Command v.db.join returns error.
I am trying to join two attribute tables (era2011 linked to the vector of
area polygons era2011 with key=cat, and erb2011) of the same size:

% v.db.join map=era2011 layer=1 column=cat otable=erb2011 ocolumn=erid

Column cat in table era2011 is of type integer.
Column erid in table erb2011 is of type smallint.

I got an error:

Adding column <erid> to the table
DBMI-PostgreSQL driver error:
Unable to execute:
ALTER TABLE era2011 ADD COLUMN erid INTEGER(2)
ERROR:  syntax error at or near "("
LINE 1: ALTER TABLE era2011 ADD COLUMN erid INTEGER(2)
ERROR: Error while executing: 'ALTER TABLE era2011 ADD COLUMN erid 
INTEGER(2)'
ERROR: Unable to add column <erid INTEGER(2)>.
ERROR: Error creating column <erid>


The same error (syntax error at or near "(") I got in case the
integer columns in the otable are of type integer (integer(4)).


The v.db.join works if the first table (era2011) already has empty columns
which correspond to the columns of the otable (erb2011).

Does this mean that I have first to add columns to the attribute table of 
layer 1 and after that the v.db.join can be used for updateing attribute 
values in these columns?


Thanks for advices!


Andres Kuusk
Tartu Observatory, Estonia


More information about the grass-user mailing list