On 16 July 2013 09:59, Rainer M Krug <rai...@krugs.de> wrote: > > Vaclav Petras <wenzesl...@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? > Yes you can, see my example. Generally, you can call C functions from C++ code and create C wrapper for your C++ library (you can find documentation everywhere, note especially the extern "C" declaration).
> 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. > I have only that small example (attached) but it contains all you need, however there were also some problems [2]. > 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 <rai...@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@lists.osgeo.org >>> http://lists.osgeo.org/mailman/listinfo/grass-dev > > > -- > Rainer M. Krug > > email: RMKrug<at>gmail<dot>com > > _______________________________________________ > grass-dev mailing list > grass-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/grass-dev
test_rgrass.R
Description: Binary data
_______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev