[GRASS-user] v.db.connect additional attribut table

Falko Engel falko_e at gmx.net
Sat Jul 4 11:38:09 EDT 2009


Dear List,

I am still running into problems with connecting an additional attribute
table to an existing map.
I am using postgres to store all tables in. This is my setup: GRASS 6.4
RC5, Suse 11.1, and Postgresql 8.3.7.

I have a polygon (area, centroid) map containing my whole study area.
There are about 10000 polygones in this map.
In an additional table with about 300 rows I have extra information for
some of the posygones of the original geometry.

In the map's original attribute table there is a colum with an
identifier that is also used in the additional table. It is in string
format.

Can someone tell me how I can connect the table to the map as a second
layer?



Heres what I already did:

# Reclass cats of map according to identifier column
v.reclass input=map output=map_reclass column=identifier



# Using SQL
------------------------------------------------------------------
# Update an integer column "table_id" in the new table with the cat
values of the map according to the identifier column

UPDATE new_table
SET table_id = map_reclass.cat
FROM map_reclass
WHERE new_table.identifier = map_reclass.identifier
#
-------------------------------------------------------------------------------------------

v.db.connect -o map=map_reclass key=table_id layer=2 table=new_table
v.category map_reclass option=add layer=2 output=map_reclass_layer2



I am sure there is something wrong because I can't work with layer 2
after this operation.


v.category input=map_reclass_layer2 option=report

Layer/Tabelle: 2/map_reclass_layer2_2
Typ       Anzahl        Min        Max
Punkt          0          0          0
Linie           0          0          0
Grenze   26072          1      26072
Zentroid   10205      26073      36277
Fläche           0          0          0
Alle        36277          1      36277

Layer/Tabelle: 1/map_reclass_layer2_1
Typ       Anzahl        Min        Max
Punkt          0          0          0
Linie           0          0          0
Grenze       0          0          0
Zentroid   10115          1       8543
Fläche           0          0          0
Alle        10115          1       8543

Thanks for any help!

Falko


More information about the grass-user mailing list