[GRASS-dev] Direct link from GRASS to R via C

Rainer M Krug Rainer at krugs.de
Tue Jul 16 00:59:19 PDT 2013


Vaclav Petras <wenzeslaus at gmail.com> writes:

> Hi,
Hi,

>
> you probably know, I've once started the discussion on this topic on
> grass-stats ML (very simple test code included) [1]. And I've also
> tried some basic example and experienced some problems [2]. 

To my shame, I must say I overlooked your threads. I am aware of the
problem which Roger discussed, therefore I think it would be the best to
write a function in GRASS which is exported and is doing the access and
simply returns the column / block / complete raster (i.e. a *very basic*
exported raster access api for grass). 

This function could be called then from Rcpp and it would be much easier
then writing the complete access function in Rcpp (as you mention below,
I also think that the header files locations might be a problem).


> To the
> information you provided I would add that the new functionality have
> to be written in C++ since Rcpp is only for C++.

I am always confused by these two and how they are linked together - can
I use C libraries from Rcpp, as described above?

As you already have done some work (could you please mail it to me as I
can't access the attachment via gmane?), I would very much appreciate
your input - also my C / C++ experience is quite limited and input from
that side would be brilliant.

Thanks,

Rainer

>
> Vaclav
>
> [1] http://lists.osgeo.org/pipermail/grass-stats/2012-July/001422.html
> [2] http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-July/004055.html
>
>
> On 15 July 2013 17:30, Rainer M Krug <Rainer at krugs.de> wrote:
>> The following message is a courtesy copy of an article
>> that has been posted to gmane.comp.gis.grass.devel as well.
>>
>> Hi
>>
>> I posted on my blog an outline of an idea of how spatial data could be
>> easily loaded from GRASS into R and written back.
>>
>> (see http://rmkrug.wordpress.com/2013/07/15/grassrlink-1/)
>>
>> In a nutshell, the idea would be to use the C functions in GRASS to
>> write a function which returns a single column, column range or whole
>> raster. This function could then be called from R (via Rcpp) to get the
>> data into R without having to worry about intermittent exports and
>> imports via the hdd.
>>
>> I would ike to have some input from the GRASS developer community what
>> they think about such a function. This function should be usable as
>> "stand alone", and not requiring the opening and buffer allocations et
>> al as in the r.example, but rather simply take the mapset, raster name,
>> column(s) to read, if MASK should be respected, ... arguments.
>>
>> I was thinking that it would be useful to have such a function in GRASS,
>> as the compilation together with GRASS, in the same line as a module,
>> would be quite easy.
>>
>> Initially, I was thinking about read and write support for rasters,
>> which then could be extended to vectors and 3d-rasters and possibly even
>> the temporal data.
>>
>> Could you give feedback on what y9ou think about the idea, and how you
>> think it could be realized (simplicity to install would be important).
>>
>> Cheers and thanks,
>>
>> Rainer
>>
>> --
>> Rainer M. Krug
>>
>> email: RMKrug<at>gmail<dot>com
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-dev


-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20130716/e5ca7149/attachment-0001.pgp>


More information about the grass-dev mailing list