On Sat, July 4, 2009 17:38, Falko Engel wrote: > 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
By default, v.category option=add will create new categories starting from 1 and incremented by 1. These category numbers are probably very different from the contents of your table_id column, and, therefore, your connection will show no attributes as there are no lines in the table which have a table_id equal to a category number in your map. To use the same category values as in another layer, you can insert the cat values from the database table in one layer to a column in your new layer using 'v.to.db ... option=query qlayer=OtherLayer qcolumns=IdColumnInOtherLayer'. If you want you can then reclass according to that column. Moritz _______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user