[R-sig-Geo] Importing GRASS-Rasters into R

Roger Bivand Roger.Bivand at nhh.no
Mon Feb 13 17:39:45 CET 2012


On Mon, 13 Feb 2012, Johannes Radinger wrote:

> Hi,
>
> I just tranferred to R-sig.geo list:
>
>> On Mon, 13 Feb 2012, Johannes Radinger wrote:
>>
>>> Dear Roger,
>>>
>>> as you wrote the spgrass6 package for R, you are most probably the
>>> one who can help me.
>>>
>>> On the one hand I am working with GRASS and have created several Raster
>>> maps in a mapset. On the other hand I am working with R in the Eclipse
>>> environement and run different scripts also involving dismo (species
>>> distribution models). Therefore I need my GRASS raster maps tranfered to
>>> R as a RasterStack. As I don't want to run the script from R within a
>>> GRASS session, what is the easiest way to get all the raster maps of one
>>> mapset into a rasterstack in R (in my Eclipse session)? What are the
>>> single steps (R-commands) I need to do? Do I need to set a pseudo
>>> location when I don't run any GRASS commands from R, only the export to
>>> the RasterStack?
>>
>> No idea, I don't use Eclipse. Trouble was reported recently with a similar
>> front end messing up the path for loading dynamic library objects. Try
>> R-sig-geo or statgrass, please. Have you tried initGRASS() in the Eclipse
>> setting?
>
> It was more of a general question if i have to set a pseudolocation etc. 
> with initGRASS() when I only want to use readRAST6 and working outside 
> GRASS? If I need to set the location, is it possible to use the location 
> which is already existing (created by GRASS itself), although i am 
> running R outside GRASS?

In principle yes, but you have to be aware that you may trash your .gisrc 
file, hence the need for care. Others use this method for simulation 
without problems, but with care and some experience.

Roger

>
>
> /Johannes
>
>>
>> Roger
>>
>>>
>>> My rasters are here:
>>> GISDBASE=/Users/Johannes Radinger/Documents/GRASS-GIS
>>> LOCATION_NAME=Treene_location
>>> MAPSET=SDM_Treene
>>>
>>>
>>> Best regards,
>>> Johannes
>>>
>>
>> --
>> 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
>>
>
>

-- 
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