[GRASSLIST:10119] v.to.db option=query: issue with 2 layers and multiple categories

Maciek Sieczka werchowyna at epf.pl
Wed Feb 1 15:13:19 EST 2006


	The problem:



	In case when a vector in layer 2 has more than one categories
	assigned, and in layer 1 it has only one category, v.to.db
	option=query fails to copy attributes from layer 1 to layer 2,
	due to "Multiple query results, output value set to NULL". Is
	this a bug in v.to.db? I would expect both layer 2 datatables to
	be populated with the same value, not NULL.




	The whole story. I hope you will make it to read it:



	I had a vector line made of two parts, connected with a node. I
	have converted it to points (v.to.points). As a result 2 points
	were created at that node. So I removed one duplicate with
	v.clean. Now this point attributes look like this (d.what.vect):


598394.0625(E) 5681271.65625(N)

testing_pt_nodupl2 in melio  Point
Layer: 1
category: 2
driver: dbf
database: //home/grassdata/caves_utm33/melio/dbf/
table: testing_pt_nodupl2_1
key column: cat
cat : 2
height : 100.500000
Layer: 2
category: 11
driver: dbf
database: //home/grassdata/caves_utm33/melio/dbf/
table: testing_pt_nodupl2_2
key column: cat
cat : 11
lcat : 2
along : 0.000000
Layer: 1
category: 1
driver: dbf
database: //home/grassdata/caves_utm33/melio/dbf/
table: testing_pt_nodupl2_1
key column: cat
cat : 1
height : 100.500000
Layer: 2
category: 10
driver: dbf
database: //home/grassdata/caves_utm33/melio/dbf/
table: testing_pt_nodupl2_2
key column: cat
cat : 10
lcat : 1
along : 890.245313



	I wanted to populate the "height" from layer 1 to layer 2.
	First I'll create a column to be populated with "height" values:



v.db.addcol map=testing_pt_nodupl layer=2 col="z double"



	Now, when I tried to populate all the "height" attributes from
	layer 1 to "z" in layer 2 a problem occured:



v.to.db map=testing_pt_nodupl2 type=point layer=2 qlayer=1 option=query
column=z qcolumn=height Reading data trom the map ... 

Querying database ... 

Multiple query results, output value set to NULL (category 11)


Multiple query results, output value set to NULL (category 10)
Updating database ... 

17 categories read from map
17 records selected from table
17 categories read from map exist in selection from table
0 categories read from map don't exist in selection from table
17 records updated/inserted
0 update/insert errors



	In spite of "0 update/insert errors" actually there _are_
	errors, due to "Multiple query results". Only 16 points have
	their "z" populated with "height" as needed. The vector point
	having the both 10 and 11 category (due to v.clean), has the
	attribute "z" not set, as d.what.vect says:



598394.0625(E) 5681271.65625(N)

testing_pt_nodupl2 in melio  Point
Layer: 1
category: 2
driver: dbf
database: //home/grassdata/caves_utm33/melio/dbf/
table: testing_pt_nodupl2_1
key column: cat
cat : 2
height : 100.500000
Layer: 2
category: 11
driver: dbf
database: //home/grassdata/caves_utm33/melio/dbf/
table: testing_pt_nodupl2_2
key column: cat
cat : 11
lcat : 2
along : 0.000000
z : 
Layer: 1
category: 1
driver: dbf
database: //home/grassdata/caves_utm33/melio/dbf/
table: testing_pt_nodupl2_1
key column: cat
cat : 1
height : 100.500000
Layer: 2
category: 10
driver: dbf
database: //home/grassdata/caves_utm33/melio/dbf/
table: testing_pt_nodupl2_2
key column: cat
cat : 10
lcat : 1
along : 890.245313
z : 



	Is this a bug in v.to.db? I would expect both categories 10 and
	11 to be assinged the same "z", not none.

	I might be simply not getting something here. I will appreciate
	any comments.

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/




More information about the grass-user mailing list