On Wed, Sep 30, 2015 at 2:02 AM, Anna Petrášová <[email protected]> wrote:
> > > On Tue, Sep 29, 2015 at 6:09 PM, Paulo van Breugel <[email protected] > > wrote: > >> This must be a very basic question, but I can't find an easy/direct way >> to do this. In python, if I have an array with values with a length equal >> to the number of rows in an attribute table of a (point) vector layer, how >> can I write those values to a new column in that attribute table. I can of >> course first create the column, but than how to update that column with the >> values in the array? >> > > it should be pretty easy to do with pygrass, unfortunately there is no > example on assigning attributes in the official documentation [1], but it > should be pretty easy, something like that (not tested): > > with VectorTopo('myvector', mode='w') as vectormap: > for feature in vectormap: > feature.attrs['mycolumn'] = value > > > Thanks, but that seems to write the vector back without attribute table > Anna > > [1] > https://grass.osgeo.org/grass70/manuals/libpython/pygrass_vector.html#working-with-vector-objects > >> >> Cheers, >> >> Paulo >> >> _______________________________________________ >> grass-dev mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/grass-dev >> > >
_______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
