Have tried the following:
initGRASS("C:\\OSGeo4W\\bin",home="U:\\Documents and
Settings\\pgiraudo\\",override=T)
initGRASS("C:\\Program Files\\Quantum GIS\\grass",home="U:\\Documents
and Settings\\pgiraudo",override=T)
initGRASS("C:\\OSGeo4W\\bin",override=T)
with the same results...
> initGRASS("C:\\OSGeo4W\\bin",home="U:\\Documents and
Settings\\pgiraudo\\",override=T)
Error in system(paste("g.dirseps.exe -g",
shQuote(Sys.getenv("WINGISRC"))), :
g.dirseps.exe not found
> 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",override=T)
Error in Sys.setenv(GISRC = gisrc) : wrong length for argument
Quite puzzling since g.dirseps does not give a message "unknown command"
when tried within grass (thus it is suppose to be in the GRASS programme)
Patrick
Roger Bivand a écrit :
On Mon, 7 Dec 2009, Patrick Giraudoux wrote:
Here is the result:
library(spgrass6)
debug(initGRASS)
initGRASS("C:/OSGeo4W/bin",home="U:/Documents and
Settings/pgiraudo/",override=T)
(...)
Browse[2]>
debug: gisrc <- system(paste("g.dirseps.exe -g",
shQuote(Sys.getenv("WINGISRC"))),
intern = TRUE)
Browse[2]> Sys.getenv("WINGISRC")
WINGISRC
"U:/Documents and Settings/pgiraudo/\\.grassrc6"
Browse[2]> shQuote(Sys.getenv("WINGISRC"))
[1] "\"U:/Documents and Settings/pgiraudo/\\.grassrc6\""
Browse[2]> gisrc
Error: object 'gisrc' not found
Could you try both not setting home= (you get a temporary folder that
is deleted when you exit R), or setting
home="U:\\Documents and Settings\\pgiraudo"
without the trailing forward slash?
This a problem connected to protecting spaces on the one hand and
system specific directory separators on the other, I think.
Roger
Beforehand, the first time I run
initGRASS("C:/OSGeo4W/bin",home="U:/Documents and
Settings/pgiraudo/",override=T), I got:
initGRASS("C:/OSGeo4W/bin",home="U:/Documents and
Settings/pgiraudo/",override=T)
Error in system(paste("g.dirseps.exe -g",
shQuote(Sys.getenv("WINGISRC"))), :
g.dirseps.exe not found
Then, if I try the same commande on QGIS Metis, I got:
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
Best,
Patrick
Roger Bivand a écrit :
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
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo