[R-sig-Geo] CVS updates to rgdal

Tim Keitt tkeitt at gmail.com
Tue Sep 12 20:17:04 CEST 2006


Hi Folks,

Just though I'd let people know that there is an experimental branch
("THK") of rgdal in CVS at the sourceforge site. It passes "R CMD
check" on my machine.

Major changes are:

1) "new" is no longer used to open datasets. "openDataset" (or
equivalently "GDAL.open") is now the only way to open existing
datasets, eg,

    ds1 <- openDataset("test.tif", read.only = FALSE)

I'd like to have a consistent set of function names, so I'm
considering deprecating GDAL.(open|close).

2) A "createDataset" function is defined to make it easy to create a
GDAL dataset to hold the output of your analysis, eg,

   ds2 <- createDataset("GTiff", 1024, 1024, 1, "Float64", "output.tif")
   # calls to putRasterData
   closeDataset(ds2)

(Also, in general you can now provide either the driver object or the
driver name as a string.)

2a) There are some tricky issues with the "copyDataset" (GDAL's copy
dataset function does not actually copy any data by design) and
"saveDataset" functions. These may go away or be rewritten from
scratch.

3) The "offset" argument to "getRasterData" and "getRasterTable" has
been replaced with "at" which specifies the location of the upper-left
corner to begin reading/writing rather than the offset from the image
origin. This simplifies looping over scanlines or blocks. I'd like to
see this change however to some more general and flexible mechanism of
specifying data regions. One that would allow using (x,y) and
(row,column) interchangably, and perhaps in the future allow for
arbitrary polygons.

4) A new function "RGB2PCT" will convert three bands of raster data
into a single-band dithered image with a pseudocolor lookup table. The
"displayDataset" function has returned. It only displays a single
band, but will automatically use the pseudocolor lookup table
generated by "RGB2PCT" (or whatever color table is attached to the
raster band). "displayDataset" automatically decimates the input to
make drawing the image faster, but does not yet use embedded
overviews. (Roger also has a function that takes a 3-band
SpatialGridDataFrame and dithers/builds the PCT -- we probably need to
merge these or wrap one with the other.)

The change from "offset" to "at" is likely to have broken the "sp"
related functions. We'll need to review those or come up with the
alternative to "at" and rewrite as necessary.

A few more items that would be nice to include might be having
"getRasterData" and  "putRasterData" return/accept "sp" objects. It
will add an extra step when reading raster data as it would require
the data to be unpacked from the "sp" object for manipulation in R (if
I understand the "sp" setup). It would be no more than obj$data or
something like that.

Cheers,
Tim

-- 
Timothy H. Keitt
http://www.keittlab.org/




More information about the R-sig-Geo mailing list