<div dir="ltr">Hi all,<div><br></div><div>is there an easy way to transfer the information reported by <a href="http://v.net" target="_blank">v.net</a> (operation=report)</div><div>directly to the attribute table of the vector network (arc-table)?</div><div><br></div><div>The approach I am using so far is to create an temporary database table (using python)</div><div>where I store the output from <a href="http://v.net" target="_blank">v.net</a> operation=report, and then use a SQL statement to update the original arc-table from the temporary table:</div><div><br></div><div>###########</div><div><div>fidimo_db.execute('''CREATE TEMP TABLE arcs_temp </div><div><span style="white-space:pre-wrap">                                                   </span>(cat INTEGER, from INTEGER, to INTEGER)''')</div><div><br></div><div># Get for each arc the orig cat for the start (from) and end point (to)</div><div>e = [(int(x.split()[0]),int(x.split()[1]),int(x.split()[2])) for x in grass.read_command("<a href="http://v.net" target="_blank">v.net</a>",</div><div><span style="white-space:pre-wrap">      </span>quiet=True,</div><div><span style="white-space:pre-wrap">      i</span>nput="my_net",</div><div><span style="white-space:pre-wrap">        </span>operation="report",</div><div><span style="white-space:pre-wrap">    </span>arc_layer=3).splitlines()]</div><div>my_db.executemany("INSERT INTO arcs_tmp (cat, from, to) VALUES (?,?,?)", e)</div><div><br></div><div>my_db.execute('''UPDATE arcs SET </div><div><span style="white-space:pre-wrap">                     </span>from = (SELECT from FROM arcs_tmp WHERE cat=<a href="http://arcs.cat" target="_blank">arcs.cat</a>),</div><div><span style="white-space:pre-wrap">                   </span>to = (SELECT to FROM arcs_tmp WHERE cat=<a href="http://arcs.cat" target="_blank">arcs.cat</a>)</div><div><span style="white-space:pre-wrap">                        </span>WHERE EXISTS (SELECT cat FROM arcs_tmp WHERE cat=<a href="http://arcs.cat" target="_blank">arcs.cat</a>)''')</div></div><div>##########</div><div><br></div><div>That approach works for me, but I was wondering if there is something easier/more direct? However it seems a direct update of the attribute table is not included in <a href="http://v.net" target="_blank">v.net</a>. The module v.db.update has an option for adding start/end points of lines, however this refers to coordinate pairs rather than to category values of nodes in a network.</div><div><br></div><div>Any other ideas?</div><div><br></div><div>Best,</div><div>Johannes</div></div>