[GRASS-user] vector attribute calculation in grass python
atourej at gmail.com
Tue Aug 30 08:15:40 PDT 2016
Problem solved! Suggestion was made to use db.execute and it worked without
variable declaration. Thanks for your insight!
On Aug 30, 2016 3:17 AM, "Moritz Lennert" <mlennert at club.worldonline.be>
> Dear Alassane,
> Please keep conversations on the list.
> On 29/08/16 19:49, alassane toure wrote:
>> Dear Moritz,
>> I am a newbi in python programming. Following your instructions i added
>> the followings..
>> but pchng stayed NULL for all rows (see below)!
> You set pchng = range(len(par_sqf)),
> but par_sqf is only defined as a Python variable by
> so it is normal that it is NULL.
> Don't mix up Python variables and vector map column names.
> If you want to set the attribute column pchng to contain a value that is
> equal to the length of the value of the attribute column par_sqf (i.e.
> count the number of digits (plus decimal point) in the area value), then
> you have to use v.db.update:
> v.db.update map=parcel column=pchng qcol="length(par_sqf)"
> Although I don't understand what the sens of such a length would be.
> Maybe it would be easier if you explained us what you are trying to do,
> instead of only how you are doing it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-user