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?
Here a working example (in the NC location) for illustrating my problem: ### Import test line to GRASS GIS echo "ORGANIZATION: GRASS Development Team DIGIT DATE: 03/12/2015 DIGIT NAME: - MAP NAME: test_lines MAP DATE: 2015 MAP SCALE: 10000 OTHER INFO: test lines ZONE: 0 MAP THRESH: 0.500000 VERTI: L 3 1 641045.70521951 218398.66077254 641049.6221644 218261.56770124 641026.12049504 218155.8101891 1 5" | v.in.ascii --o format=standard input=- output=test_lines # Add attribute table to imported line v.db.addtable map=test_lines # Add some attributes to table including the original cat as attribute v.db.addcolumn map=test_lines@fidimo_test columns="col1 INT, old_cat INT" v.db.update map=test_lines@fidimo_test column=col1 value=42 v.db.update map=test_lines@fidimo_test column=old_cat query_column=cat # Import Point echo "100|641045.940579|218320.669742" | v.in.ascii --o input=- output=mypoints x=2 y=3 cat=1 # Create network v.net -s --overwrite input=test_lines \ points=mypoints output=test_net operation=connect threshold=25 # 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 ############# The attribute table of the final vector (test_net_newcat) should contain only two rows for cat 1 and 2 with the original attribute information for both rows. Is that somehow possible in GRASS? /Johannes On Wed, Dec 2, 2015 at 4:55 PM, Moritz Lennert <mlenn...@club.worldonline.be > wrote: > On 02/12/15 15:40, Johannes Radinger wrote: > >> Hi all, >> >> I built a GRASS7 network using v.net <http://v.net>: >> >> First, I used the 'connect' option to snap some points to my network >> (using the -s flag) >> Second, I used that first network and also added all nodes with the >> 'nodes' option to get a final network. >> >> With the 'report' option of v.net <http://v.net> I can report all edges >> with their start and end end points. However, these edges of the final >> network are based on the initial category values of the input vector. >> How can I get the network split into single lines with unique IDs >> between each node of the final network. In other words I want a report >> of v.net <http://v.net> that contains only unique edge categories? I'd >> like to write the output of v.net <http://v.net> into a new table and >> assign lengths to each edge. >> >> For example, at the moment, a line with cat=300 is confined by a start >> node cat=1 and an end node cat=2. For that case v.net <http://v.net> >> reports: >> 300 1 2 >> >> If I connect a new node with cat=3 along that line and calculate v.net >> <http://v.net>, it reports: >> 300 1 3 >> 300 3 2 >> >> Any ideas/suggestions? Maybe I need to 'break' the network lines at each >> node before running v.net <http://v.net>? >> > > How about v.category op=delete type=line followed by v.category op=add > type=line ? > > Moritz >
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user