GRASS logo

NAME

v.db.calc

DESCRIPTION

v.db.calc executes a python expression using column values and update the target column values: it allows complex calculation also with DBF attribute table.

NOTES

The v.db.calc must be run with a valid Python installed.
The columns within expression should be referred between square brackets [ ] .
Python functions should be referred with their full name.

EXAMPLE

Add a new column named EXP and populate it with the values of column "VAL" elevated at 0.25:
v.db.addcol map=build columns="EXP double"
v.db.calc input=myvector field=EXP exp="math.pow([VAL], 0.25)"
Add a new column named EXP and populate it with the values of column "VAL" elevated at 0.25 only where column HEIGHT is bigger then 100:
v.db.addcol map=build columns="EXP double"
v.db.calc input=myvector field=EXP exp="math.pow([VAL], 0.25)" where="HEIGHT>100"

Add a new text column named TXT and populte it concatenating Dr. and the text values of the column NAME:

v.db.addcol map=build columns="TXT varchar(25)"
v.db.calc input=edifici field=EXP2 exp="'Dr. '+'[NAME]'"

REFERENCES

Python

Python math library

SEE ALSO

v.db.update

AUTHOR

Massimiliano Cannata

Last changed: $Date$


Main index - vector index - Full index

© 2003-2016 GRASS Development Team