[R-sig-Geo] GRASS commands

Roger Bivand Roger.Bivand at nhh.no
Tue Sep 1 14:40:13 CEST 2009


On Tue, 1 Sep 2009, Alexandre VILLERS wrote:

> Goord morning,
> 
> I would like to use v.mkgrid (with spgrass6) and I need to specify box and
> grid parameters, which both require 2 values box=5000,5000 grid=1000,1000
> How do I specify this in my parameters list ?
> parseGRASS6("v.mkgrid") returns
> Command: v.mkgrid
> Extension: .exe
> Description: Creates a GRASS vector map of a user-defined grid.
> Keywords: vector
> Parameters:
>   name: map, type: string, required: yes, multiple: no
>  [Name for output vector map]
>   name: grid, type: integer, required: yes, multiple: no
>  [Number of rows and columns in grid]
>   name: position, type: string, required: no, multiple: no
>  [Where to place the grid]
>   name: coor, type: float, required: no, multiple: no
>  [Lower left easting and northing coordinates of map]
>   name: box, type: float, required: no, multiple: no
>  [Width and height of boxes in grid]
>   name: angle, type: float, required: no, multiple: no
>  [Angle of rotation (in degrees counter-clockwise)]
> Flags:
>   name: q [Quiet; No chatter]
>   name: overwrite [Allow output files to overwrite existing files]
>   name: verbose [Verbose module output]
>   name: quiet [Quiet module output]
> 
> execGRASS("v.mkgrid", flags="overwrite", 
parameters=list(map="grilleTest",
> grid=c(as.integer(100),as.integer(100)), box=c(5000, 5000),
> position="region"))
> returns
> Erreur dans doGRASS(cmd, flags = flags, parameters = parameters) :
>   Parameter <grid> has multiple values
> 
> How do I specify the two values when multiple is not allowed. I did not get
> it....

Consider the statsgrass list for use of the interface between R and 
GRASS, in this case there is an interaction between a possible bug in 
v.mkgrid and the parsing of its parameters.

Since v.mkgrid does declare that grid does *not* take multiple values, the 
(current) logic of doGRASS() is defeated, as it checks that the multiple 
attribute if the GRASS parameter is not "NO", see

http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.mkgrid/main.c#L74

The discrepancy between the code and the documentation is obvious.

Please ask on a GRASS list whether other scripted interfaces experience 
the same problem - as far as I can see from the wxpython interface, only a 
single value is accepted, but running the command fails because two are 
required (same problem in reverse). Thw widget used for entering the 
parameter values does not the entry of two values. The work-around for now 
is to use v.mkgrid in system() directly.

Hope this helps,

Roger

> 
> Thanks
> 
>

-- 
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: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list