<br><br><div class="gmail_quote">On Wed, Oct 19, 2011 at 8:36 AM, Markus Neteler <span dir="ltr">&lt;<a href="mailto:neteler@osgeo.org">neteler@osgeo.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Oct 18, 2011 at 10:26 AM, Rainer M Krug &lt;<a href="mailto:r.m.krug@gmail.com">r.m.krug@gmail.com</a>&gt; wrote:<br>
&gt; If this mail has made it already to the lst, I apologise - I just could not<br>
&gt; find it anywhere.<br>
&gt;<br>
&gt;<br>
&gt; Hi<br>
&gt;<br>
&gt; I am thinking about the possibility of loading raster directly from GRASS<br>
&gt; into R, to avoid the overhang of saving to disk and loading again or having<br>
&gt; gdal in between GRASS and R.<br>
&gt;<br>
&gt; As R (using the sp package) holds the raster in memory, I was thinking about<br>
&gt; reading the data from GRASS by using a C function, returning the cell values<br>
&gt; and additional info (at least the one provided in  esri ACSII file, i.e.<br>
&gt; NCOLS, NROWS, XLLCORNER, YLLCORNER, CELLSIZE, NODATA_VALUE) plus<br>
&gt; geo-referencing info, so that, back in R, this data can be assembled to<br>
&gt; become a spatial object (SpatialGridDataFrame, as defined in the package<br>
&gt; sp).<br>
<br>
</div>An option may be to<br>
- open the raster map,<br></blockquote><div><br>What do you mean by &quot;open the raster map)?<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

- set computational region to the map<br></blockquote><div><br>Good idea - but it would also be an option to use the active region, to enable the reading of certain selected regions.<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

- read G_get_window()<br>
<br>
<a href="http://grass.osgeo.org/programming6/get__window_8c.html#ada28852284056440f08c032e64a80765" target="_blank">http://grass.osgeo.org/programming6/get__window_8c.html#ada28852284056440f08c032e64a80765</a><br></blockquote>
<div><br>Thanks - that&#39;s great.<br>That enables me to get the header date to construct a raster with the same info in R as a SpatialGrisDataFrame.<br><br>Now I would need a function, which reads the cell values and returns it - either the complete raster, or the by column / row, and then I could assemble it - any ideas?<br>
<br>Rainer<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font color="#888888"><br>
Markus<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)<br><br>Centre of Excellence for Invasion Biology<br>Stellenbosch University<br>
South Africa<br><br>Tel :       +33 - (0)9 53 10 27 44<br>Cell:       +33 - (0)6 85 62 59 98<br>Fax (F):       +33 - (0)9 58 10 27 44<br><br>Fax (D):    +49 - (0)3 21 21 25 22 44<br><br>email:      <a href="mailto:Rainer@krugs.de" target="_blank">Rainer@krugs.de</a><br>
<br>Skype:      RMkrug<br><br>