[GRASS-user] Calculation with attributes of point file

Moritz Lennert mlennert at club.worldonline.be
Tue May 17 10:14:20 EDT 2011


On 16/05/11 16:32, Johannes Radinger wrote:
> Hallo,
>
> I've got a point file and populated (v.what.rast) it with values from a flow direction raster (flow direction from r.watershed).
>
> I want to use these values to rotate the symbol in ps.map but therefore I've to recalulcate the values in the direction-column of the point file (x*45+90 or so).
>
> How can that be done? I thought about v.reclass but don't really know how?!
>
> Another option would be to access the sqlite database and perform the calculation there (I am working in a python script) like:
> database = sqlite3.connect(os.path.join(gisdbase, location, mapset, 'sqlite.db'))
> db = database.cursor()
> db.execute .... but what is the correct command for calculation within a database??
>
> Probably it is easier than I think... :)

If you want to modify an existing column:

v.db.update col=YourExistingColumn value=YourCalculation

If you want to create a new column:

v.db.addcolumn col="YourNewCol double precision"
v.db.update col=YourNewCol value=YourCalculation

Moritz


More information about the grass-user mailing list