[GRASS-dev] Re: Problem when loading GRASS 6 raster with large integer values into R via r.out.bin

Roger Bivand Roger.Bivand at nhh.no
Wed Sep 17 04:49:45 EDT 2008


Markus Neteler <neteler <at> osgeo.org> writes:

> 
> On Tue, Sep 16, 2008 at 6:50 PM, Rainer M Krug <r.m.krug <at> gmail.com> wrote:
> > Hi
> >
> > I have a problem with importing raster maps of type CELL into R -
> > larger values become "wrapped" around as r.out.bin saves the raster
> > values as shortint values. Is there any possibility to change that
> > behaviour, or at least convert the exported values automatically from
> > integer to float?
> 
> My suggestion to Roger was to change to r.out.gdal:
>  http://lists.osgeo.org/pipermail/grass-stats/2008-June/000799.html
> 
> Since the GRASS-R interface knows the GRASS version it could be
> conditionalized upon GRASS >= 6.3.0 for r.out.gdal, r.out.bin otherwise.

The actual suggestion was not to use r.out.gdal, but to use the GRASS GDAL
plugin if present. Then readRAST6() would use readGDAL() to read the 
raster directly if possible, using the GRASS plugin driver. This avoids 
creating a temporary file, but could be used directly from readGDAL() - 
it just sets up the correct path and file name.

> 
> Something has been implemented but it needs/ed to be activated
> by setting parameters (at least in June, didn't check later).
> 

At present with default plugin=NULL, readRAST6() checks the list of drivers 
and if "GRASS" is present, and if the current and raster file regions agree, 
and only one raster is requested, it imports the raster directly into a 
SpatialGridDataFrame object using readGDAL(). If Rainer's data are in a 
raster that has the same region as the current region, the plugin would 
solve the problem.

I can look at using r.out.gdal for making the temporary file, but IIRC, it 
suffers from the region mismatch problem that r.out.bin solves by resampling 
on the fly.

Hope this helps,

Roger



> Markus
> 






More information about the grass-dev mailing list