[GRASS-stats] error initGRASS - rgrass7
Markus Neteler
neteler at osgeo.org
Fri Jul 31 07:56:04 PDT 2015
Hi,
On Fri, Jul 24, 2015 at 9:47 AM, Rainer M Krug <Rainer at krugs.de> wrote:
> Markus Neteler <neteler at osgeo.org> writes:
>
>> On Wed, Jul 22, 2015 at 3:11 PM, Rainer M Krug <Rainer at krugs.de> wrote:
>>> Hi Veronica,
>>>
>>> Veronica Andreo <veroandreo at gmail.com> writes:
>>>
>>>> Hi,
>>>>
>>>> I'm trying to run GRASS from R using:
>>>>
>>>> library(rgrass7)
>>>> initGRASS(gisBase="/home/veroandreo/software/grass-7.0.svn",
>>>> home=tempdir(), gisDbase="/home/veroandreo/grassdata",
>>>> location="latlong_wgs84", mapset="clorofila", override=TRUE)
>>>
>>> I assume you use Linux.
>>>
>>>>
>>>> but I get the following error:
>>>>
>>>> sh: g.gisenv: command not found
so, I found the trick:
In the first place, find out the path to the GRASS GIS library. This
can be easily done with the following command (still outside of R; or
through a system() call inside of R):
grass70 --config path
It may report something like:
/home/veroandreo/software/grass-7.0.svn/dist.x86_64-unknown-linux-gnu
This path must be used then:
library(rgrass7)
# initialisation and the use of North Carolina sample dataset
initGRASS(gisBase =
"/home/veroandreo/software/grass-7.0.svn/dist.x86_64-unknown-linux-gnu",
home = tempdir(),
gisDbase = "/home/veroandreo/grassdata/",
location = "nc_spm_08_grass7", mapset = "user1", SG="elevation",
override = TRUE)
...
and it works fine.
I have updated the Wiki page accordingly:
http://grasswiki.osgeo.org/wiki/R_statistics/rgrass7#GRASS_within_R
Cheers
Markus
More information about the grass-stats
mailing list