[GRASS-user] v.to.db
Paolo Craveri
pcraveri at gmail.com
Tue Jan 20 07:17:17 EST 2009
Hi all
I cannot understand why v.to.db needs a connected table on layer 1 to
upload values on table linked to layer 2; e.g.:
# # # spearfish60
g.copy vect=archsites,mypoints --o
v.category in=mypoints out=mypoints2 layer=2 opt=add --o
# # # remove connection from layer 1
v.db.connect -d mypoints2 layer=1
# # # remove table from layer 1
db.droptable mypoints2 -f
# # # create a table
echo "CREATE TABLE mypoints2_2 (cat integer, x double precision, y
double precision)" | db.execute
# # # connect table to layer 2
v.db.connect map=mypoints2 layer=2 key=cat table=mypoints2_2
# # # try v.to.db to upload some values to table on layer 2 without
table on layer 1
v.to.db mypoints2 layer=2 opt=cat col=cat
v.to.db mypoints2 layer=2 opt=coor col=x,y
# # # get an error:
# # # ERROR: Database connection not defined for layer 1. Use
v.db.connect first.
# # # no error if layer 1 is connected to table
# # # create a foo table on layer 1
v.db.addtable mypoints2 layer=1
# # # v.to.db upload correctly values to table on layer 2
v.to.db mypoints2 layer=2 opt=cat col=cat
v.to.db mypoints2 layer=2 opt=coor col=x,y
Are there any particular reasons for that?
ciao
--
--
Paolo C.
Lat. 44° 39' 11.08'' N Long. 7° 23' 25.26'' E
More information about the grass-user
mailing list