Opened 15 years ago

Closed 12 years ago

#1000 closed defect (fixed)

v.category option=del doesn't delete multiple cats per object

Reported by: needelsd Owned by: grass-dev@…
Priority: normal Milestone: 6.4.0
Component: Vector Version: 6.4.0 RCs
Keywords: v.category v.to.points v.clean delete replace cats Cc:
CPU: Unspecified Platform: Unspecified

Description

The manual for for v.category option=del states that it will "delete all categories of given layer". However, only one cat per object is deleted for objects with multiple cats (listed separated by a "/").

Here is a Spearfish example that starts with a line vector with multiple segments, generates a point vector from the nodes (in layer 2), removes the resulting duplicate points, and then attempts to delete the layer 2 cats in order to generate new cats with sequential values.

# Extract 5 lines, extract nodes into layer 2 v.edit map=L_1 tool=create --o v.edit map=L_1 tool=copy ids=17,424-426,496 bgmap=roads v.to.points -n input=L_1 output=P_1_raw # Remove duplicate points (overlapping nodes from adjacent segments) v.clean input=P_1_raw output=P_1 tool=snap,rmdupl thresh=.1,-1 type=point --o # Replace cat values with sequential values v.category input=P_1 output=P_1_no_cats option=del layer=2 --o v.category input=P_1_no_cats output=P_1_cats option=add layer=2 --o

# Expected result- layer 2 cat values 1-6 v.category input=P_1_cats option=print layer=2 ## cat 1 2 1 2 3 6

# The v.clean tool=rmdupl step results in objects with multiple cats separated by "/" v.category P_1 option=print layer=2 ## cat 4 9 10/1 5/2 8/3 7/6

# The v.category option=del step only removes the first cat of each pair v.category input=P_1_no_cats option=print layer=2 ## cat 1 2 3 6

Change History (4)

comment:1 by needelsd, 15 years ago

I am running William Kyngesburye's 6.4RC5-3 on Mac OS X Leopard.

in reply to:  description comment:2 by martinl, 15 years ago

Replying to needelsd:

Please use pre-formatted text otherwise it's not readable.

# Extract 5 lines, extract nodes into layer 2
v.edit map=L_1 tool=create --o
v.edit map=L_1 tool=copy ids=17,424-426,496 bgmap=roads
v.to.points -n input=L_1 output=P_1_raw
# Remove duplicate points (overlapping nodes from adjacent segments)
v.clean input=P_1_raw output=P_1 tool=snap,rmdupl thresh=.1,-1 type=point --o
# Replace cat values with sequential values
v.category input=P_1 output=P_1_no_cats option=del layer=2 --o
v.category input=P_1_no_cats output=P_1_cats option=add layer=2 --o
 
# Expected result- layer 2 cat values 1-6
v.category input=P_1_cats option=print layer=2
## cat  1 2 1 2 3 6

# The v.clean tool=rmdupl step results in objects with multiple cats separated by "/"
v.category P_1 option=print layer=2
## cat  4 9 10/1 5/2 8/3 7/6
 
# The v.category option=del step only removes the first cat of each pair
v.category input=P_1_no_cats option=print layer=2
## cat  1 2 3 6

comment:3 by needelsd, 15 years ago

Please use pre-formatted text otherwise it's not readable.

Thanks for cleaning up my mess (newbie error). Note to self: the Preview button is there for a reason.

comment:4 by mmetz, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in all branches (r52773, 5, 6).

Markus M

Note: See TracTickets for help on using tickets.