Hi,
I got a second time trapped by the problem that v.db.addtable
(no longer?) adds rows into the new attribute table. I suspect
that a v.category call is needed before v.to.db (at the end
of the script). But v.category would write into a new map
and then handling gets messy.
Example:
# Spearfish
g.copy vect=fields,myfields
v.db.addtable myfields layer=2 col="polynum integer"
v.category myfields op=report layer=2
LAYER/TABLE 1/myfields:
type count min max
point 0 0 0
line 0 0 0
boundary 0 0 0
centroid 63 1 63
area 0 0 0
all 63 1 63
-> it's not clear from this output that it is only layer 1!!
(try: v.category myfields op=report layer=33
which gives the same result)
So: in reality there aren't any categories yet on layer 2.
v.category myfields out=myfields_new op=add layer=2
v.db.select myfields_new layer=2
cat|polynum
Nothing again. I think that there should be a row for each
vector now but it isn't. Due to that I cannot use v.db.update
on it to insert new polynum values.
?
Markus
Markus,
2007/5/18, Markus Neteler <neteler@itc.it>:
[snip]
# Spearfish
g.copy vect=fields,myfields
v.db.addtable myfields layer=2 col="polynum integer"
v.category myfields op=report layer=2
LAYER/TABLE 1/myfields:
type count min max
point 0 0 0
line 0 0 0
boundary 0 0 0
centroid 63 1 63
area 0 0 0
all 63 1 63
-> it's not clear from this output that it is only layer 1!!
(try: v.category myfields op=report layer=33
which gives the same result)
yes, the option 'report' in contrast to the other options (like
'print') is not influenced by 'layer' option. Maybe it is confusing
for the user and should be changed (?).
So: in reality there aren't any categories yet on layer 2.
v.category myfields out=myfields_new op=add layer=2
v.db.select myfields_new layer=2
cat|polynum
Nothing again. I think that there should be a row for each
vector now but it isn't. Due to that I cannot use v.db.update
on it to insert new polynum values.
this should work
v.category in=fields out=myfields lay=2 opt=add;
v.db.addtable myfields layer=2 col="polynum integer";
v.db.select myfields_new layer=2
Martin
Markus
_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev
--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *
opps, sorry
v.category in=fields out=myfields lay=2 opt=add;
v.db.addtable myfields layer=2 col="polynum integer";
v.db.select myfields_new layer=2 <- typo
v.db.select myfields layer=2
Martin
--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *