[STATSGRASS] NULL values and readRAST6

Roger Bivand Roger.Bivand at nhh.no
Tue Oct 9 09:20:18 EDT 2007


On Tue, 9 Oct 2007, Hamish wrote:

> Roger Bivand wrote:
>> To make this a bit clearer - the raster layer in GRASS has missing values
>> set to NULL, but NULL cannot be exported by r.out.bin. So r.out.bin is
>> given a NODATA value to assign to NULL cells, which are then read into R,
>> and the NODATA valued cells are set to NA. The only need for the value is
>> to keep r.out.bin (and r.in.bin) happy, because they do not encode NULL
>> directly.
>
>
> IIUC there is a rgdal pacakge. Why not use it to directly read the GRASS map?
> If GDAL's GRASS plugin is not present or the rgdal package is not loaded in R
> it can fall back to using the r.{in|out}.bin or r.{in|out}.ascii methods.
>
> (given the r.out.bin NULL restriction, maybe the r.out.ascii format is safer,
> albeit a bit slower)

Because GRASS 6.2 is still the scripted r.out.gdal, using the plugin, 
*and* the plugin does not (correct me?) use the current region, but uses 
the raster map in its "native" form, so doing an r.out.gdal -> tempfile -> 
readGDAL() risks getting different regions etc. Getting the plugin working 
properly across platforms is less than convenient too. This is a 
showstopper when reading multiple rasters into a single 
SpatialGridDataFrame.

With GRASS 6.3 this goes away, because r.out.gdal is compiled and does 
respect the current region (like r.out.bin does).

As the interface needs to support both GRASS < 6.3 and >= 6.3, using 
r.*.bin is simpler. A bit lame, but the GRASS 5 interface is still 
supported for users who are still there.

Roger

>
> ?,
> Hamish
>
>
>
>      ____________________________________________________________________________________
> Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.
> http://autos.yahoo.com/index.html
>
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the grass-stats mailing list