[GRASS-stats] Using GRASS addons in R on Windows

Roger Bivand Roger.Bivand at nhh.no
Mon Jan 11 06:06:29 PST 2016


On Mon, 11 Jan 2016, Helmut Kudrnovsky wrote:

>> completely accessible elsewhere:
>>
>> https://r-forge.r-project.org/projects/spgrass/
>>
>> using SVN.
>
> I've done a SVN checkout.
>
> I'm not sure that I can contribute code diffs, but here are some test
> findings:


OK, thanks. SVN commited revisions at # 45. I've sent a build request to R 
Winbuilder to get a regular Windows rgrass7 binary, ready now at:

http://win-builder.r-project.org/s90s00N7rhyt/

WN_bat should now include *.bat files in GRASS_ADDON_BASE, which is in the 
PATH for me using Windows Native (not checked with OSGeo4W). References to 
msys and WINGISBASE removed.

Comments welcome,

Roger

>
>> library(rgrass7)
> Loading required package: sp
> Loading required package: XML
> GRASS GIS interface loaded with GRASS version: GRASS 7.0.3RC1 (2015)
> and location: nc_spm_08_grass7
>
> -------------------
>
> AFAIK msys is dropped in winGRASS7
>
> C:\tmp\rg\rgrass7\pkg\rgrass7\R\AAA.R
>
>  SYS <- ""
>  if (.Platform$OS.type == "windows") {
>    if (Sys.getenv("OSTYPE") == "msys") SYS <- "msys"
>    else SYS <- "WinNat"
>  } else if (.Platform$OS.type == "unix") SYS <- "unix"
>  assign("SYS", SYS, envir=.GRASS_CACHE)
>
>   res <- ""
>  if (SYS == "msys" || SYS == "WinNat") res =".exe"
>  assign("addEXE", res, envir=.GRASS_CACHE)
>  assign("WN_bat", "", envir=.GRASS_CACHE)
> 
>> t1 <- .Platform$OS.type
>> t1
> [1] "windows"
>> t2 <- Sys.getenv("OSTYPE")
>> t2
> [1] ""
>>
>
> so maybe simplified to:
>
>  if (.Platform$OS.type == "windows") SYS <- "WinNat"
>  else if (.Platform$OS.type == "unix") SYS <- "unix"
> [...]
>  if (SYS == "WinNat") res =".exe"
>  assign("addEXE", res, envir=.GRASS_CACHE)
>
> 
>
>  if (SYS == "WinNat" && nchar(gisrc) > 0) {
>    pyScripts <- basename(list.files(paste(Sys.getenv("WINGISBASE"),
>      "scripts", sep="/"), pattern="py$"))
>    names(pyScripts) <- sub("\\.py", "", pyScripts)
>    assign("pyScripts", pyScripts, envir=.GRASS_CACHE)
> 
>> t3 <- Sys.getenv("WINGISBASE")
>> t3
> [1] ""
>> t4 <- Sys.getenv("GISBASE")
>> t4
> [1] "C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3RC1"
>> t5 <- Sys.getenv("GRASS_ADDON_BASE")
>> t5
> [1] "C:\\Users\\myricaria\\AppData\\Roaming\\GRASS7\\addons"
>
>> pyScripts <- basename(list.files(paste(Sys.getenv("GISBASE"), "scripts",
>> "scripts", sep="/"), pattern="py$"))
>> pyScripts
>  [1] "d.correlate.py"          "d.out.file.py"
>  [3] "d.polar.py"              "d.rast.edit.py"
>  [5] "d.rast.leg.py"           "d.redraw.py"
>  [7] "d.shade.py"              "d.to.rast.py"
>  [9] "d.what.rast.py"          "d.what.vect.py"
> [11] "db.dropcolumn.py"        "db.droptable.py"
> [13] "db.in.ogr.py"            "db.out.ogr.py"
> [15] "db.test.py"              "db.univar.py"
> [17] "g.extension.all.py"      "g.extension.py"
> [19] "g.gui.animation.py"      "g.gui.dbmgr.py"
> [21] "g.gui.gcp.py"            "g.gui.gmodeler.py"
> [23] "g.gui.iclass.py"         "g.gui.mapswipe.py"
> [25] "g.gui.psmap.py"          "g.gui.rlisetup.py"
> [27] "g.gui.timeline.py"       "g.gui.tplot.py"
> [29] "g.gui.vdigit.py"         "g.manual.py"
> [31] "i.colors.enhance.py"     "i.image.mosaic.py"
> [33] "i.in.spotvgt.py"         "i.oif.py"
> [35] "i.pansharpen.py"         "i.spectral.py"
> [37] "i.tasscap.py"            "m.proj.py"
> [39] "r.blend.py"              "r.buffer.lowmem.py"
> [41] "r.colors.stddev.py"      "r.fillnulls.py"
> [43] "r.grow.py"               "r.import.py"
> [45] "r.in.aster.py"           "r.in.srtm.py"
> [47] "r.in.wms.py"             "r.mask.py"
> [49] "r.out.xyz.py"            "r.pack.py"
> [51] "r.plane.py"              "r.reclass.area.py"
> [53] "r.rgb.py"                "r.shade.py"
> [55] "r.tileset.py"            "r.unpack.py"
> [57] "r3.in.xyz.py"            "t.create.py"
> [59] "t.info.py"               "t.list.py"
> [61] "t.merge.py"              "t.rast.accdetect.py"
> [63] "t.rast.accumulate.py"    "t.rast.aggregate.ds.py"
> [65] "t.rast.aggregate.py"     "t.rast.colors.py"
> [67] "t.rast.export.py"        "t.rast.extract.py"
> [69] "t.rast.gapfill.py"       "t.rast.import.py"
> [71] "t.rast.list.py"          "t.rast.mapcalc.py"
> [73] "t.rast.neighbors.py"     "t.rast.out.vtk.py"
> [75] "t.rast.series.py"        "t.rast.to.rast3.py"
> [77] "t.rast.univar.py"        "t.rast3d.extract.py"
> [79] "t.rast3d.list.py"        "t.rast3d.mapcalc.py"
> [81] "t.rast3d.univar.py"      "t.register.py"
> [83] "t.remove.py"             "t.rename.py"
> [85] "t.sample.py"             "t.select.py"
> [87] "t.shift.py"              "t.snap.py"
> [89] "t.support.py"            "t.topology.py"
> [91] "t.unregister.py"         "t.vect.db.select.py"
> [93] "t.vect.export.py"        "t.vect.extract.py"
> [95] "t.vect.import.py"        "t.vect.list.py"
> [97] "t.vect.observe.strds.py" "t.vect.univar.py"
> [99] "t.vect.what.strds.py"    "v.build.all.py"
> [101] "v.centroids.py"          "v.db.addcolumn.py"
> [103] "v.db.addtable.py"        "v.db.dropcolumn.py"
> [105] "v.db.droprow.py"         "v.db.droptable.py"
> [107] "v.db.join.py"            "v.db.reconnect.all.py"
> [109] "v.db.renamecolumn.py"    "v.db.univar.py"
> [111] "v.db.update.py"          "v.dissolve.py"
> [113] "v.import.py"             "v.in.e00.py"
> [115] "v.in.geonames.py"        "v.in.lines.py"
> [117] "v.in.mapgen.py"          "v.in.wfs.py"
> [119] "v.krige.py"              "v.pack.py"
> [121] "v.rast.stats.py"         "v.report.py"
> [123] "v.to.lines.py"           "v.unpack.py"
> [125] "v.what.strds.py"         "v.what.vect.py"
> [127] "wxpyimgview.py"
>>
>
> AFAIK variable %WINGISBASE% isn't there anymore in winGRASS7, it's now
> %GISBASE%
> -------------------
>
> C:\tmp\rg\rgrass7\pkg\rgrass7\R\rgrass.R
>
> .addexe <- function() {
>    res <- ""
>    SYS <- get("SYS", envir=.GRASS_CACHE)
>    if (SYS == "msys" || SYS == "WinNat") res =".exe"
>    res
> }
>
> maybe simplified to:
>
>    if (SYS == "WinNat") res =".exe"
>
> -------------------
>
> C:\tmp\rg\rgrass7\pkg\rgrass7\R\xml1.R
>
>    bin_out_win <- c("d.colors.exe", "d.save.exe", "d.what.rast.exe",
>      "d.what.vect.exe", "d.zoom.exe", "g.parser.exe", "gis.m.bat",
>      "i.spectral.bat", "mkftcap.bat", "r.mapcalc.exe", "r.tileset.bat",
>      "r3.mapcalc.exe", "v.in.gpsbabel.bat", "v.proj.exe")
> 
> "gis.m.bat" -> AFAIK gis.m is dropped in GRASS7
>
>
>
> -----
> best regards
> Helmut
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/Using-GRASS-addons-in-R-on-Windows-tp5244411p5244520.html
> Sent from the Grass - Stats mailing list archive at Nabble.com.
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
http://depsy.org/person/434412


More information about the grass-stats mailing list