[GRASS-dev] v.to.db problems if layer > 1

Markus Neteler neteler at osgeo.org
Wed Nov 26 05:34:51 EST 2008


I try to use v.db.addtable with a second layer but v.to.db apparently fails
(called by v.db.addtable):

# Spearfish
g.copy vect=roads,myroads --o
v.info -c myroads
v.db.addtable myroads table=extratab layer=2 columns="cat
integer,label varchar(100)"
...
Updating database...
 100%
1 categories read from map       <- BAD should be 6
...

v.db.select myroads layer=2
cat|label
                        <- empty, should have 6 cats

# compare layer1:
v.db.select myroads layer=1
cat|label
0|no data
1|interstate
2|primary highway, hard surface
3|secondary highway, hard surface
4|light-duty road, improved surface
5|unimproved road

-----------
# calling directly v.to.db
v.to.db myroads layer=2 option=cat col=cat qlayer=1
Updating database...
 100%
1 categories read from map
6 records selected from table
0 records updated/inserted

There is something odd in vector/v.to.db/update.c if the layer>1 but I
cannot find it.
There is a loop
    for (i = 0; i < vstat.rcat; i++) {

I wonder why it doesn't loop over vstat.select.

?
Markus

PS: note today's changes in SVN of v.to.db


More information about the grass-dev mailing list