[R-sig-Geo] spgrass6 and InitGrass

Roger Bivand Roger.Bivand at nhh.no
Thu Oct 6 15:51:19 CEST 2011


On Thu, 6 Oct 2011, Tomislav Hengl wrote:

>
> Op 6-10-2011 15:19, Roger Bivand schreef:
>> On Thu, 6 Oct 2011, Tomislav Hengl wrote:
>> 
>>> 
>>> I'm having problems using GRASS 6.4.1 from R under windows 7. I've
>>> installed GRASS and then loaded spgrass6 and tried:
>>> 
>>>> library(spgrass6)
>>> Loading required package: XML
>>> GRASS GIS interface loaded with GRASS version: (GRASS not running)
>>>> GRASS <- shortPathName(utils::readRegistry("SOFTWARE\\WOW6432NODE\\GRASS
>>> 6.4.1")$InstallPath)
>>> > GRASS
>>> [1] "C:\\PROGRA~2\\GRASS6~1.1"
>>> > initGRASS(gisBase=GRASS, home=tempdir())
>>> Error in initGRASS(gisBase = GRASS, home = tempdir()) :
>>> Platform variant not supported
>> 
>> This means that we need to check deeper. What do:
>> 
>> .Platform$OS.type
>> Sys.getenv("OSTYPE")
>> library(spgrass6)
>> get("SYS", envir=spgrass6:::.GRASS_CACHE)
>> 
>> report? If the first is the string "windows", and the second is "", the
>> internal variable get("SYS", envir=spgrass6:::.GRASS_CACHE) is set to
>> "WinNat". I suspect that one or other of these doesn't hold, and that
>> SYS isn't being set to "WinNat" - on OSX and Linux, it is set to "unix";
>> "msys" and "cygwin" also exist, but are not supported for initGRASS(). I
>> only have access (now) to 32-bit XP.
>
> I get:
>
>> .Platform$OS.type
> [1] "windows"
>> Sys.getenv("OSTYPE")
>   OSTYPE
> "US_W764"
>> library(spgrass6)
> Loading required package: XML
> GRASS GIS interface loaded with GRASS version: (GRASS not running)
>> get("SYS", envir=spgrass6:::.GRASS_CACHE)
> [1] ""
>
> I could also try installing 32-bit GRASS GIS....

No, that wouldn't help, I'm afraid. Until I research/fix this, can I ask 
anyone else using Windows and spgrass6 to email me off-list with the 
output of:

R.version
.Platform$OS.type
Sys.getenv("OSTYPE")

and your informal description (Windows 7, 64-bit ... or whatever) It looks 
as though the "OSTYPE" environment variable is now being set, and is 
carrying locale, Windoes version, and architecture codes.

A work-around is to set the cached variable directly:

get("SYS", envir=spgrass6:::.GRASS_CACHE)
assign("SYS", "WinNat", envir=spgrass6:::.GRASS_CACHE)
get("SYS", envir=spgrass6:::.GRASS_CACHE)

immediately after loading spgrass6. Then initGRASS() will branch 
correctly, and should put things in the correct place.

Roger

>
>> 
>> Roger
>> 
>> 
>>> 
>>> > paste(R.version$version.string, Sys.info()[["sysname"]],
>>> Sys.info()[["release"]])
>>> [1] "R version 2.12.2 (2011-02-25) Windows 7 x64"
>>>> sessionInfo()[["otherPkgs"]][["spgrass6"]][["Version"]]
>>> [1] "0.7-4"
>>> 
>>> (sorry Roger, it probably means that you have to update the package :(
>>> 
>>> T. Hengl
>>> http://www.wewur.wur.nl/popups/vcard.aspx?id=HENGL001
>>> 
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>> 
>> 
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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