[R-sig-Geo] [GRASS-stats] Re: GRASS commands (fwd)

Roger Bivand Roger.Bivand at nhh.no
Wed Sep 2 16:09:13 CEST 2009


On Tue, 1 Sep 2009, alexandre villers wrote:

> Good evening,
>
> Thank you for the message. I had already tried this but then got the error message:
>
> execGRASS("v.mkgrid", flags="overwrite", parameters=list(map="grilleTest", grid=paste(as.integer(100), as.integer(100), sep=","), box=paste(as.integer(5000),",",as.integer(5000),sep=""), position="region")) #créer une grille de box1 mètres sur box2 mètres sur la région   !!! PB WITH the double argument required for box and grid).
> Erreur dans doGRASS(cmd, flags = flags, parameters = parameters) :
>  Parameter <grid> does not have integer value

I've submitted a new version of spgrass6 to CRAN that handles the 
ambiguity inherent in the multiple=no and a keydesc count of greater than 
1. When it gets through, please try. If you like, check out the source 
from r-spatial on sourceforge. I'd be interested to know whether this also 
resolves your earlier r.neighbors problem.

Roger

>
> Does this make sense to you ? v.mkgrid is asking for an integer but the paste() has turned integer into character... and list of the 2 integers is also rejected because of the "multiple = NO" argument...
>
> I'm afraid I can't go further...
>
> Best regards
>
> Alex
>
> -----Original Message-----
> From: Markus Neteler <neteler at cealp.it>
> To: Roger.Bivand at nhh.no
> Date: Tue, 01 Sep 2009 22:22:49 +0200
> Subject: Re: [GRASS-stats] Re: [R-sig-Geo] GRASS commands (fwd)
>
> 2009/9/1 Roger Bivand <Roger.Bivand at nhh.no>:
> > Is this a bug in the interface description of v.mkgrid? It needs
> > grid=rows,columns but sets multiple=NO, so wxpython fails (needing two
> > values but getting one, but only providing an integer entry box).
>
> It needs two values which are treated as one string, so it is correct.
> (E.g. r.series accepts multiple input maps which are separate tokens which
> required multiple=YES).
>
> ...
> >> 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....
>
> You used
> > c(as.integer(100),as.integer(100))
> [1] 100 100
>
> > c(5000, 5000)
> [1] 5000 5000
>
> which leads to space separated values. But we want
>
> > paste(as.integer(100), as.integer(100), sep=",")
> [1] "100,100"
>
> > 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.
>
> There is no real discrepancy...
> Hope above comments clarify it.
>
> If not, we would need to see some debug output of doGRASS()...
>
> Markus
>
>

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