[GRASS-stats] Using GRASS addons in R on Windows
Roger Bivand
Roger.Bivand at nhh.no
Mon Jan 11 15:45:38 PST 2016
On Mon, 11 Jan 2016, Helmut Kudrnovsky wrote:
>> The link is *not* to CRAN, and a lot more testing will be needed before I
> even submit to CRAN - re your link from GRASS-dev to this thread. I need to
> know that use cases of g.extensions installed workflows now succeed where
> previously they failed for OSGeo4W and native Windows builds of GRASS. CRAN
> isn't used for speculating about possibilities that things might (or might
> not) work - that is R-forge, from which you may svn update, then R CMD build
> rgrass7, then R CMD INSTALL --build rgrass7_0.1-4.tar.gz (using RTools),
> then install from local zip file, then run the workflow.
>>
>> There are other pending edits to vector file transfer on Windows, so the
> extensions issue isn't alone enough to trigger a submission to CRAN.
>
> thanks for the clarification.
>
> tested now:
>
> -----------------------
>
> versuche URL
> 'http://R-Forge.R-project.org/bin/windows/contrib/3.2/rgrass7_0.1-4.zip'
> Content type 'application/zip' length 85081 bytes (83 KB)
> downloaded 83 KB
>
> -----------------------
>
> GRASS version: 7.0.3RC1
> GRASS SVN Revision: 67443
> Build Date: 2015-12-31
> Build Platform: x86_64-w64-mingw32
> GDAL/OGR: 1.11.3
> PROJ.4: 4.9.2
> GEOS: 3.5.0
> SQLite: 3.7.17
> Python: 2.7.5
> wxPython: 2.8.12.1
> Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
>
> -----------------------
>
> binary addon (r.stream.order)
>
> in GRASS:
>
> r.watershed elevation=elevation at PERMANENT threshold=10000
> accumulation=myaccum drainage=myflowdir stream=mystreams
> r.stream.order stream_rast=mystreams at rtestw64bit
> direction=myflowdir at rtestw64bit elevation=elevation at PERMANENT
> accumulation=myaccum at rtestw64bit strahler=mystrahler
>
> in R:
>
>> 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
>
> execGRASS("r.watershed", elevation="elevation", threshold=10000,
> accumulation="myaccum", drainage="myflowdir", stream="mystreams")
>
>> execGRASS("r.watershed", elevation="elevation", threshold=10000,
>> accumulatio$ ...
> SECTION 1a (of 5): Initiating Memory.
> SECTION 1b (of 5): Determining Offmap Flow.
> 100%
> SECTION 2: A* Search.
> 100%
> SECTION 3a: Accumulating Surface Flow with MFD.
> 100%
> SECTION 3b: Adjusting drainage directions.
> 100%
> SECTION 4: Watershed determination.
> 100%
> SECTION 5: Closing Maps.
> 100%
>
> execGRASS("r.stream.order", stream_rast="mystreams", direction="myflowdir",
> elevation="elevation", accumulation="myaccum", strahler="mystrahler")
>
>> execGRASS("r.stream.order", stream_rast="mystreams",
>> direction="myflowdir", $ ...
> All in RAM calculation...
> Reading raster map <mystreams>...
> 100%
> Reading raster map <myflowdir>...
> 100%
> Finding nodes...
> Calculating Strahler's stream order...
> Writing output raster maps...
>
> -----------------------
>
> python addon (r.roughness.vector):
>
> in GRASS:
>
> r.slope.aspect elevation=elevation at PERMANENT slope=myslope aspect=myaspect
> r.roughness.vector elevation=elevation at PERMANENT slope=myslope at rtestw64bit
> aspect=myaspect at rtestw64bit strength=vectorstrength
>
> in R:
>
> execGRASS("r.slope.aspect", elevation="elevation", slope="myslope",
> aspect="myaspect")
>
>> execGRASS("r.slope.aspect", elevation="elevation", slope="myslope",
>> aspect="$
> 100%
> Aspect raster map <myaspect> complete
> Slope raster map <myslope> complete
>
> execGRASS("r.roughness.vector", elevation="elevation", slope="myslope",
> aspect="myaspect", strength="vectorstrength")
>
>> execGRASS("r.roughness.vector", elevation="elevation", slope="myslope",
>> aspe$
> Error in system(cmd0, intern = TRUE) : 'r.roughness.vector.exe' not found
> Error in parseGRASS(cmd, legacyExec = legacyExec) :
> r.roughness.vector not found
>
> -----------------------
>
> python GRASS script (r.reclass.area):
>
> in GRASS:
>
> r.reclass.area input=zipcodes at PERMANENT output=zipcode_larger2000ha
> value=2000 mode=greater
>
> in R:
>
> execGRASS("r.reclass.area", input="zipcodes", output="zipcode_larger2000ha",
> value=2000, mode="greater")
>
>> execGRASS("r.reclass.area", input="zipcodes",
>> output="zipcode_larger2000ha",$
> Error in system(cmd0, intern = TRUE) : 'r.reclass.area.exe' not found
> Error in parseGRASS(cmd, legacyExec = legacyExec) :
> r.reclass.area not found
>
> -----------------------
>
> in summary (tested in OSGeo4W-winGRASS):
>
> - binary addon (e.g. r.stream.order) is reckognized and can be run via
> execGRASS
> - python scripts (python GRASS GIS scripts e.g. r.reclass.area _and_ python
> addon scripts) aren't found; it seems it is searched for an .exe, in
> winGRASS these scripts are started by a related .bat-file.
>
>
Wrong target, please use:
http://win-builder.r-project.org/s90s00N7rhyt/rgrass7_0.1-4.zip
R-Forge builds nightly, Winbuilder builds on demand. The R-forge version
has now caught up, but you need to check the SVN revision number too. I
did provide the link to the R Winbuilder binary, but contributors should
download RTools an build their own Windows binaries if speed matters. I do
not use Windows, so I cannot check everything. We need more reports from
users installing the Winbuilder or R-forge rev. 46 binary.
Roger
>
>
>
>
> -----
> best regards
> Helmut
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/Using-GRASS-addons-in-R-on-Windows-tp5244411p5244618.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