[GRASS-stats] Using GRASS addons in R on Windows
Paulo van Breugel
p.vanbreugel at gmail.com
Wed Jan 13 09:05:53 PST 2016
On 13-01-16 14:42, Roger Bivand wrote:
> On Wed, 13 Jan 2016, Helmut Kudrnovsky wrote:
>
>>> http://win-builder.r-project.org/KJJJkeazt7Sw/rgrass7_0.1-5.zip
>>>
>>> Could users of initGRASS() please check that the environment
>>> variables are
>>> set correctly for addons?
>>
>>> sessionInfo()
>> R version 3.2.3 (2015-12-10)
>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>> Running under: Windows 7 x64 (build 7601) Service Pack 1
>>
>> locale:
>> [1] LC_COLLATE=German_Austria.1252 LC_CTYPE=German_Austria.1252
>> LC_MONETARY=German_Austria.1252 LC_NUMERIC=C [5]
>> LC_TIME=German_Austria.1252
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>> other attached packages:
>> [1] rgrass7_0.1-5 XML_3.98-1.3 sp_1.2-2
>> loaded via a namespace (and not attached):
>> [1] grid_3.2.3 lattice_0.20-33
>>
>>> library(rgrass7)
>> Lade nötiges Paket: sp
>> Lade nötiges Paket: XML
>> GRASS GIS interface loaded with GRASS version: (GRASS not running)
>>
>>> initGRASS("C:/Program Files/GRASS GIS 7.1.svn", home=tempdir(),
>>> gisDbase="C:/grassdata", location="nc_spm_08", mapset="user1")
>> gisdbase C:/grassdata location nc_spm_08 mapset user1
>> rows 6 columns 8 north 222800 south 222740
>> west 642590 east 642670 nsres 10 ewres 10
>> projection +proj=lcc +lat_1=36.16666666666666 +lat_2=34.33333333333334
>> +lat_0=33.75 +lon_0=-79 +x_0=609601.22 +y_0=0 +no_defs +a=6378137
>> +rf=298.257222101 +towgs84=0.000,0.000,0.000 +to_meter=1
>>> execGRASS("g.region", raster="elevation", align="elevation", flags="a")
>>
>>> execGRASS("r.slope.aspect", elevation="elevation", slope="myslope",
>>> aspect="myaspect")
>>
>> Expositions-Rasterkarte <myaspect> komplett.
>> Neigungs-Rasterkarte <myslope> komplett.
>>> execGRASS("r.roughness.vector", elevation="elevation", slope="myslope",
>>> aspect="myaspect", strength="vectorstrength")
>> ----
>> Check if input files exist ...
>> ----
>> Define default output names when not defined by user ...
>> ----
>> Calculate compass aspect values ...
>> ----
>> Calculate colatitude ...
>> ----
>> Calculate direction cosines ...
>> ----
>> Calculate sum of direction cosines ...
>> Calculating sum of X direction cosines ...
>>
>> Calculating sum of Y direction cosines ...
>>
>> Calculating sum of Z direction cosines ...
>>
>> ----
>> Calculate vector strength ...
>> ----
>> Calculate inverted Fisher's K parameter ...
>> ----
>> Result maps:
>> vectorstrength
>> elevation_fisher_1K_3x3
>> Calculations done.
>> ----
>>
>>> execGRASS("r.reclass.area", input="zipcodes",
>>> output="zipcode_larger2000ha", value=2000, mode="greater")
>> Generating a clumped raster file ...
>> Pass 1 of 2...
>>
>> Generating renumbering scheme...
>>
>> Pass 2 of 2...
>>
>> r.clump komplett. 16 clumps.
>> Generating a reclass map with area size greater than or equal to
>> 2000.000000 hectares...
>>
>> Generating output raster map <zipcode_larger2000ha>...
>>>
>>
>> it seems to work properly in:
>>
>> R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
>> Copyright (C) 2015 The R Foundation for Statistical Computing
>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>>
>> thanks!
>>
>
> Thanks very much for checking! Could someone please report on status
> for OSX, and corroborate my finding that it works for my source
> installed GRASS on Fedora - other Linux variants and installation
> mechanisms (Ubuntu etc. installed binary?? may vary.
>
> Best wishes,
>
> Roger
Hi Roger,
thanks for this update, great! I just checked for Ubuntu 14.04. When
running R from within a GRASS session, I can now use installed GRASS
addons. Great! initGRASS doesn't seem to work though (I never use it, so
if I am overlooking something, please let me know). See below:
> library(rgrass7)
> initGRASS("/usr/local/grass7", home=tempdir())
sh: 1: g.gisenv: not found
sh: 1: g.gisenv: not found
sh: 1: g.gisenv: not found
sh: 1: g.gisenv: not found
sh: 1: g.gisenv: not found
sh: 1: g.version: not found
Error in system(paste("g.version", get("addEXE", envir = .GRASS_CACHE), :
error in running command
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=nl_NL.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=nl_NL.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=nl_NL.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgrass7_0.1-5 XML_3.98-1.3 sp_1.2-1
loaded via a namespace (and not attached):
[1] grid_3.2.2 lattice_0.20-33
Best wishes,
Paulo
>
>>
>>
>> -----
>> best regards
>> Helmut
>> --
>> View this message in context:
>> http://osgeo-org.1560.x6.nabble.com/Using-GRASS-addons-in-R-on-Windows-tp5244411p5244989.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
>
>
>
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-stats/attachments/20160113/56df5d37/attachment.html>
More information about the grass-stats
mailing list