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

Markus Neteler neteler at osgeo.org
Wed Oct 19 02:36:58 EDT 2011


On Tue, Oct 18, 2011 at 10:26 AM, Rainer M Krug <r.m.krug at gmail.com> 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.
>
> As R (using the sp package) holds the raster in memory, I was thinking about
> reading the data from GRASS by using a C function, returning the cell values
> and additional info (at least the one provided in  esri ACSII file, i.e.
> NCOLS, NROWS, XLLCORNER, YLLCORNER, CELLSIZE, NODATA_VALUE) plus
> geo-referencing info, so that, back in R, this data can be assembled to
> become a spatial object (SpatialGridDataFrame, as defined in the package
> sp).

An option may be to
- open the raster map,
- set computational region to the map
- read G_get_window()

http://grass.osgeo.org/programming6/get__window_8c.html#ada28852284056440f08c032e64a80765

Markus


More information about the grass-dev mailing list