[GRASS-dev] Re: [GRASS GIS] #1498: patch proposal: new option for v.category to copy category values from one layer to another

GRASS GIS trac at osgeo.org
Mon Nov 28 15:40:12 EST 2011

#1498: patch proposal: new option for v.category to copy category values from one
layer to another
 Reporter:  mlennert     |       Owner:  grass-dev@…              
     Type:  enhancement  |      Status:  new                      
 Priority:  normal       |   Milestone:  7.0.0                    
Component:  Vector       |     Version:  unspecified              
 Keywords:  v.category   |    Platform:  Unspecified              
      Cpu:  Unspecified  |  

Comment(by mmetz):

 Replying to [comment:2 mlennert]:
 > Replying to [comment:1 mmetz]:
 > > Very useful addition, the transfer option!
 > >
 > > The attached second patch copies not only the first cat encountered
 but all cats of the first layer to the second layer. Type = centroid is
 now automatically activated if type = area and not type=area,centroid.
 > >
 > Thanks, Markus, for looking into this. Can we apply to trunk ? And what
 about 6.x ?

 I have added the new feature of copying categories in r49413, but with
 further modifications because the category/layer design of GRASS vectors
 is quite flexible and thus probably a bit complicated:
  * A warning is printed if categories already exist in the target layer
 (where categories are copied to). This could lead to all sorts of
 complications. I was contemplating a fatal error, but then I decided to
 follow GRASS policy: allow a lot, warn if it may be dangerous.
  * There is a new hidden feature for option=transfer, if only one layer
 number is given for the layer option, the module will find the next free
 layer number and copy categories to that new layer. No danger of confusion
 with already existing categories in that layer since it's new. This
 feature is hidden in the sense that it is documented somewhat further down
 the manual.

 Since I was on it, I changed the behaviour of option=chlayer a bit: the
 layer number of categories is changed (as before) if the current category
 number does not exist for the target layer, otherwise it is only deleted
 from the source layer (new). This avoids duplicate category entries of a
 given geometry object in the target layer.

 All changes are tested and should be backported to 6.x since they maintain
 backwards compatibility and fix an obscure but potentially disastrous bug.

 Markus M

Ticket URL: <http://trac.osgeo.org/grass/ticket/1498#comment:3>
GRASS GIS <http://grass.osgeo.org>

More information about the grass-dev mailing list