[GRASS-dev] [GRASS GIS] #1000: v.category option=del doesn't delete multiple cats per object

#1000: v.category option=del doesn't delete multiple cats per object
----------------------------------------------------------------+-----------
Reporter: needelsd | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.0
Component: Vector | Version: 6.4.0 RCs
Keywords: v.category v.to.points v.clean delete replace cats | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------------------------------------+-----------
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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1000&gt;
GRASS GIS <http://grass.osgeo.org>

#1000: v.category option=del doesn't delete multiple cats per object
--------------------------+-------------------------------------------------
  Reporter: needelsd | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: Vector | Version: 6.4.0 RCs
Resolution: | Keywords: v.category v.to.points v.clean delete replace cats
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by needelsd):

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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1000#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1000: v.category option=del doesn't delete multiple cats per object
--------------------------+-------------------------------------------------
  Reporter: needelsd | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: Vector | Version: 6.4.0 RCs
Resolution: | Keywords: v.category v.to.points v.clean delete replace cats
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [ticket:1000 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
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1000#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1000: v.category option=del doesn't delete multiple cats per object
--------------------------+-------------------------------------------------
  Reporter: needelsd | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: Vector | Version: 6.4.0 RCs
Resolution: | Keywords: v.category v.to.points v.clean delete replace cats
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by needelsd):

> 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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1000#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1000: v.category option=del doesn't delete multiple cats per object
--------------------------+-------------------------------------------------
  Reporter: needelsd | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.0
Component: Vector | Version: 6.4.0 RCs
Resolution: fixed | Keywords: v.category v.to.points v.clean delete replace cats
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by mmetz):

  * status: new => closed
  * resolution: => fixed

Comment:

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

Markus M

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1000#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>