[GRASS-dev] Re: [GRASS GIS] #739: v.mkgrid parameter needs two values but is multiple=NO

GRASS GIS trac at osgeo.org
Tue Sep 1 15:41:02 EDT 2009


#739: v.mkgrid parameter needs two values but is multiple=NO
--------------------------+-------------------------------------------------
  Reporter:  rsbivand     |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect       |      Status:  new                      
  Priority:  normal       |   Milestone:  6.4.0                    
 Component:  Vector       |     Version:  6.4.0 RCs                
Resolution:               |    Keywords:                           
  Platform:  Unspecified  |         Cpu:  Unspecified              
--------------------------+-------------------------------------------------
Comment (by neteler):

 Replying to [ticket:739 rsbivand]:
 > When run from the command line, v.mkgrid map=xxx grid=100,50 works
 (main.c, line 74), but in wxpython and execGRASS() in spgrass6 in R, the
 --interface-description of grid->multiple = NO is respected, and only one
 value can be passed. This then fails (in wxpython here) with:
 >
 >
 > {{{
 > v.mkgrid --overwrite map=grd grid=100
 > ERROR: option <grid> must be provided in multiples of 2
 >        You provided 1 items:
 >        100
 > }}}


 Yes, it must be 100,100 (the user has to specify two values).

 > In R (using --interface-description):
 >
 >
 > {{{
 > > execGRASS("v.mkgrid", flags="overwrite", parameters=list(map="grd",
 grid=as.integer(100)))
 >
 > ERROR: option <grid> must be provided in multiples of 2
 >        You provided 1 items:
 >        100
 >
 > }}}

 here you need to use

 ... grid=paste(as.integer(100), as.integer(100), sep=",")

 > or:
 >
 >
 > {{{
 > > execGRASS("v.mkgrid", flags="overwrite", parameters=list(map="grd",
 grid=rep(as.integer(100), 2)))
 > Error in doGRASS(cmd, flags = flags, parameters = parameters) :
 >   Parameter <grid> has multiple values
 > }}}

 Yes, because
 {{{
 > rep(as.integer(100), 2)
 [1] 100 100
 }}}

 which is space but not comma separated. Indeed you need to use:

 {{{
 > paste(as.integer(100), as.integer(100), sep=",")
 [1] "100,100"
 }}}


 > This conflicts with the single comma in grid->key_desc, which implies
 two values, but grid->multiple = NO. The same seems to apply to box=. It
 looks as though there is no conflict on the command line when multiple =
 NO provided that the number of values agrees with # commas in key_desc
 plus one, but that this does not work when --interface description is
 used.

 I don't think that this is a conflict: two comma separated values are
 taken as one "string".
 Instead, e.g. in r.series, multiple input maps are possible which are
 multiple = YES, hence,
 they are treated as separate tokens.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/739#comment:2>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list