[R-sig-Geo] spgrass6 and initGRASS

Roger Bivand Roger.Bivand at nhh.no
Sun Dec 6 20:52:10 CET 2009


On Sun, 6 Dec 2009, Patrick Giraudoux wrote:

> Dear all,
>
> I am trying to init a GRASS session from within R, using the function 
> initGRASS from the package spgrass6. GRASS is installed in two ways on my 
> computer (here, the OS is Windows XP): with QGIS metis (precompiled version 
> including grass 6.3 (2008)) and grass 6.4.0svn, just freshly installed with 
> the Osgeo4W installer.
>
> In both cases I get the same result:
>
>> initGRASS("C:/Program Files/Quantum GIS/grass",home="U:/Documents and 
> Settings/pgiraudo",override=T)
> Error in Sys.setenv(GISRC = gisrc) : wrong length for argument
>
>> initGRASS("C:/OSGeo4W/bin",home="U:/Documents and 
> Settings/pgiraudo",override=T)
> Error in Sys.setenv(GISRC = gisrc) : wrong length for argument
>
> Any idea about what happens ?

No, without the output of traceback(), it isn't obvious, although here 
traceback() might not help. Run under debug(initGRASS) to the step before, 
that is:

         gisrc <- system(paste("g.dirseps.exe -g",
             shQuote(Sys.getenv("WINGISRC"))), intern=TRUE)

then run:

Sys.getenv("WINGISRC")
shQuote(Sys.getenv("WINGISRC"))
gisrc

and try to see what is going on. At this stage, Sys.getenv("GISRC") should 
be "junk", assigned a couple of lines earlier.

Maybe the grass-stats list would have a higher proportion of users of both 
GRASS and R.

Hope this helps,

Roger

>
> Patrick
>

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