Vector map attribute transfer between connected tables: Difference between revisions
Jump to navigation
Jump to search
(an attempt to fix) |
No edit summary |
||
(3 intermediate revisions by one other user not shown) | |||
Line 5: | Line 5: | ||
# add new column on layer 2 (replace SIZE with the desired length): | # add new column on layer 2 (replace SIZE with the desired length): | ||
v.db.addcol regions layer=2 col='name varchar(SIZE)' | v.db.addcol regions layer=2 col='name varchar(SIZE)' | ||
# add | # add cagetory numbers into geometry and new table for layer 2: | ||
v.category regions layer=2 option=add | v.category regions layer=2 option=add | ||
# get over the relevant attributes: | # get over the relevant attributes: | ||
Line 13: | Line 13: | ||
* {{cmd|v.db.addcol}} | * {{cmd|v.db.addcol}} | ||
* {{cmd|v.category}} | |||
* {{cmd|v.to.db}} | * {{cmd|v.to.db}} | ||
[[Category: FAQ]] | [[Category: FAQ]] | ||
[[Category:Vector]] | |||
[[Category:database]] |
Latest revision as of 09:50, 23 April 2015
Q: I have a vector layer FOO which is linked to two tables in layers 1 and 2. The categories for each vector element are different in layer 1 and (e.g., a certain area may have the cat value "51" in layer 1 and a cat value of "42" in layer 2). Let's assume that layer 1 has a VARCHAR column containing the names of the region (e.g. database_layer_1: 51,"Wolfenstein", database_layer_2: 42 ). If a new VARCHAR column is added to layer 2 by v.db.addcol, how can the names from layer 1 be copied into it?
A: Try this (assuming that the varchar attribute in layer 1 is called 'name'):
# add new column on layer 2 (replace SIZE with the desired length): v.db.addcol regions layer=2 col='name varchar(SIZE)' # add cagetory numbers into geometry and new table for layer 2: v.category regions layer=2 option=add # get over the relevant attributes: v.to.db regions layer=2 option=query col=name qlayer=1 qcolumn=name