Moritz, thank you! Your proposed approach solved my problem!
On Thu, Dec 3, 2015 at 3:04 PM, Moritz Lennert <[email protected] > wrote: > On 03/12/15 14:19, Johannes Radinger wrote: > >> Hi Moritz, >> >> The two-step v.category approach (del + add) and an additional v.to.db() >> was the >> right way. Now I have the problem that there are 3 categories reported for >> one single line that got split into to (1 old cat + 2 new cats). The old >> category is still >> associated with attributes but the two new rows are empty. How can >> I get an attribute table that contains only rows for the new cats with >> the attribute information >> of the old category? >> >> [...] > >> # Remove existing cats >> v.category --overwrite input=test_net type=line cat=-1 >> output=test_net_nocat option=del >> > [...] > >> # Add new cats >> v.category --overwrite input=test_net_nocat type=line >> output=test_net_newcat option=add >> v.to.db map=test_net_newcat type=line option=cat columns=cat >> ############# >> > > Instead of removing the existing cats, add new cats in a new layer and > transfer the info into that layer's attribute table: > > > v.category --overwrite input=test_net type=line output=test_net_newcat > option=add layer=3 > v.db.addtable test_new_newcat layer=3 > v.db.addcolumn test_net_newcat lay=3 col="col1 int, old_cat int" > v.to.db test_net_newcat layer=3 op=query col=col1 query_layer=1 > query_colum=col1 > v.to.db test_net_newcat layer=3 op=query col=old_cat query_layer=1 > query_colum=cat > > Just make sure to set arc_layer=3 in the network analysis modules. > > If you really want to have arcs in layer 1, you can use v.category > op=transfer, but you will also have to change table connections of the > layers with v.db.connect. > > Moritz > > >
_______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
