[GRASS-user] Update categories/attribute table after v.clean with option break

Johannes Radinger johannesradinger at gmail.com
Wed Sep 7 01:06:47 PDT 2016


Hi,

I have a vector line map (river network) which I want to clean and break
the lines at intersections. Therefore, I use the tool v.clean with the
option break. This of course increases the number of vector lines as
several lines got broken into two or more separate lines. Now there is a
attribute table linked to the original map. I want to update this attribute
table by inserting a new column that contains a new unique ID (cat) for
each line but still keeps the old cat in another column (E.g. old_cat).
Thus the attribute table should also increase in number of rows (=number of
lines).

Now, most likely the tool to use now is v.category to get a column of new
unique categories (in another table/layer?) and the use probably a join
statement to get back the information from the original table (with doubled
entries for those lines that got broken during v.clean).

What I tried so far:

#########################
# Cleaning vector and breaking lines
v.clean -c --overwrite input=river_network_modified
output=river_network_modified_clean tool=break,snap,rmline threshold=0,50,0

# Check cats
v.category input=river_network_modified_clean option=report layer=-1
# type       count        min        max
# line       16592          1      16448

# Update cats
v.category -t --overwrite input=river_network_modified_clean type=line
output=river_network_modified_clean2 option=del
v.category -t --overwrite input=river_network_modified_clean2 type=line
output=river_network_modified_clean3 option=add

# Check cats
v.category input=river_network_modified_clean2 option=report layer=-1
# Layer: 1
# type       count        min        max
# line       16591          2      16448

# Check cats
v.category input=river_network_modified_clean3 option=report layer=-1
# Layer: 1
# type       count        min        max
# line       16592          1      16448
########################

However, I expected the max values of the latest (updated) vector to be
16592 to have really unique values for all 16592 lines (from 1 to 16592)?
But the output shows the same information as the initial input map?
Probably I am still mixing up things with categories/layers... and maybe
someone has a quick hint how to get an updated attribute table for a map
that has been processed using v.clean and where lines were broken.

/johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160907/a80d6d38/attachment-0001.html>


More information about the grass-user mailing list