[GRASS-dev] C function which returns raster and additional info?

Rainer M Krug r.m.krug at gmail.com
Tue Oct 18 08:51:58 EDT 2011


On Tue, Oct 18, 2011 at 2:13 PM, Moritz Lennert <
mlennert at club.worldonline.be> wrote:

> On 18/10/11 10:26, Rainer M Krug wrote:
>
>> If this mail has made it already to the lst, I apologise - I just could
>> not find it anywhere.
>>
>>
>> Hi
>>
>> I am thinking about the possibility of loading raster directly from
>> GRASS into R, to avoid the overhang of saving to disk and loading again
>> or having gdal in between GRASS and R.
>>
>
> Have you had a look at:
> http://cran.r-project.org/web/**packages/spgrass6/<http://cran.r-project.org/web/packages/spgrass6/>


Yes - I am using it regularly and am in more or less regular contact with
Roger, the author of the package.

In my opinion, there are a few disadvantages in the approach used (which
works perfectly fine in most cases):

The linking to GRASS si done via GDAL, the gdal-grass plugin or via export
from grass to file and import from this file.

So one needs either a middle layer to be installed (GDAL) or go via the more
time intensive way via writing to file -- loading from file. If this has to
be done a few times, it can cost a considerable amount of time. This is why
I was thinking about direct linking the two. The C or C++ code could be
called from R to get the cell values and the related metadata, and in R one
could construct the spatial layer. This would be considerably faster.

That is my reasoning to the question. As I am not involved in GRASS
development, I do not know if there is a function which I could use, or if
it could be easily be written.

Cheers,

Rainer


>
> Moritz
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20111018/1b4bd9f6/attachment.html


More information about the grass-dev mailing list