On Apr 6, 2006, at 3:16 PM, Thomas Adams wrote:
List:
Say I have imported into GRASS 6.1cvs a shapefile consisting of basin boundaries. There are NO attributes in the dbf file. What is the process by which I thematically map attributes from an ascii file that consists of identifiers (that match the IDs of the individual basins) and a value (e.g., mean rainfall)? I know this is elementary, but I just can not see how to do this in GRASS 6. I have looked through all the examples and documentation I can find with no luck.
If the basin dbf has no attributes, you'll have to add your basin ID to the vector coverage first, and then you can merge the rainfall values with db.execute (or do it outside of GRASS using, say, MySQL).
First add a column in the database for your unique ID. I'd use db.execute here too, or else do it outside of GRASS in a terminal window.
To add basin IDs, use the d.what.vect -ef command, clicking through each basin and assigning the appropriate value to the "BASIN_ID" column.
Last, as noted above, you can then (in MySQL, at least) Left- or Right-JOIN the tables WHERE index.table1 = index.table2. This type of JOIN has the added bonus of filling in missing values with NULL, so you can spot values you might have skipped.
Alternately, you could create a "RAINFALL" field in your coverage dbf file (here, I'll call it 'tablename') and use
UPDATE tablename SET 'tablename.RAINFALL'= 'othertable.rainfall' WHERE 'tablename.BASIN_ID' = 'othertable.basin_id';
to merge in the one value; I think that's the right syntax--somebody tell me if I screwed up.
Jesse