<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 2:02 AM, Anna Petrášová <span dir="ltr"><<a href="mailto:kratochanna@gmail.com" target="_blank">kratochanna@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Sep 29, 2015 at 6:09 PM, Paulo van Breugel <span dir="ltr"><<a href="mailto:p.vanbreugel@gmail.com" target="_blank">p.vanbreugel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div>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? <br></div></div></div></div></blockquote><div><br></div></span><div>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):</div><div><br></div>with VectorTopo('myvector', mode='w') as vectormap:<br>    for feature in vectormap:<br>        feature.attrs['mycolumn'] = value</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div></div></div></blockquote><div>Thanks, but that seems to write the vector back without attribute table<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Anna</div><div><br></div><div>[1] <a href="https://grass.osgeo.org/grass70/manuals/libpython/pygrass_vector.html#working-with-vector-objects" target="_blank">https://grass.osgeo.org/grass70/manuals/libpython/pygrass_vector.html#working-with-vector-objects</a></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div></div><br></div>Cheers,<br><br></div>Paulo<br></div>
<br>_______________________________________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br></blockquote></div><br></div></div>
</blockquote></div><br></div></div>