[GRASS-user] calculate values of an attribute table column

Moritz Lennert mlennert at club.worldonline.be
Wed Oct 22 08:13:34 EDT 2008


On 22/10/08 13:40, Stefanie Obmann wrote:
> I don't know what to do!
> 
> So I send an image of my GRASS shell with the error message.
> 
> Thanks so far!
> 
> 
> 
> 
> Old message:
> 
> Dear GRASS users,
> 
> I'm working with a vector map with an attribute table. I'm using the 
> GRASS tools with QGIS.
> I added a new column to my table and I don't know why my 'start editing' 
> buttons aren't activ.

This is a question for the QGIS mailing list.

> I'd like to get those new values by calculating the difference of 2 
> other existing columns.
> 
> Do you know any solution for that?
> 
> Further I thought about doing the calculation within the GRASS shell but 
> I don't know what tool I should use and how. for example the db.execute, 
> but I couldn't find any calculation possibility in it.

The calculation possibilities are anything your database backend driver 
accepts as SQL statement. See 
http://grass.osgeo.org/grass64/manuals/html64_user/sql.html.

For a difference, just do "update TABLE set NewColumn=OldCol1-OldCol2" | 
db.execute

You can also try v.db.update:

v.db.update map=YourMap col=NewColumn value="OldCol1-OldCol2"

Moritz



More information about the grass-user mailing list