On Tue, 1 Sep 2009, GRASS GIS wrote:
#739: v.mkgrid parameter needs two values but is multiple=NO
--------------------------+-------------------------------------------------
Reporter: rsbivand | Owner: [email protected]
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=",")
No,
execGRASS("v.mkgrid", flags="overwrite", parameters=list(map="grd",
grid=paste(as.integer(100), as.integer(100), sep=",")))
Error in doGRASS(cmd, flags = flags, parameters = parameters) :
Parameter <grid> does not have integer value
because doGRASS() checks the type, and with c(as.integer(100),
as.integer(100)) would concatenate correctly with a comma.
The problem is in the wrong setting of grid->multiple as NO, which simply
isn't examined from the command line. The wxpython GUI version has exactly
the same problem.
Thanks for checking!
Roger
> 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.
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [email protected]
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev