[R-sig-Geo] How do I set ENVI file interleave when using GDALTransientDataset?
Jonathan Greenberg
greenberg at ucdavis.edu
Fri Jul 10 18:54:16 CEST 2009
Roger, thanks, but I've modded the call to say:
tds.out <- new("GDALTransientDataset", driver = d.drv, rows =
dims[2],cols = dims[1], bands = bands, type = type,
options="INTERLEAVE=BIL")
I THINK this is right, because if I change the interleave to something
weird, say:
tds.out <- new("GDALTransientDataset", driver = d.drv, rows =
dims[2],cols = dims[1], bands = bands, type = type,
options="INTERLEAVE=MOO")
I get the error:
Warning message:
In .local(.Object, ...) :
GDAL Error 6: 'MOO' is an unexpected value for INTERLEAVE creation
option of type string-select.
However, the output header is still not containing the modified
interleave, its still defaulting to BSQ in the output header.
I noticed in the documentation of the GDALTransientDataset-class, the
options appear to be disabled:
"options
Driver specific options (currently ignored)"
Could this be what's going on? Is there a plan to enable these in the
future? The reason I'm going through all this is so I can make an ENVI
header ONLY (not the image file associated with it -- I'm doing that via
line-by-line writeBin statements to realize tiled processing).
--j
Roger Bivand wrote:
> On Thu, 9 Jul 2009, Jonathan Greenberg wrote:
>
>> I'm writing a function to mimic ENVI/IDL's "ENVI_SETUP_HEAD" using
>> rgdal, and I was wondering how I set the interleave (BIP vs BSQ vs BIL)?
>
> You'll need to use the options= argument to pass through these values
> when you instantiate the transient dataset. There is an example of its
> use in ?writeOGR.
>
> Roger
>
>> The subsection of my code that I assume this belongs in is below:
>>
>> driver="ENVI"
>> d.drv <- new("GDALDriver", driver)
>> tds.out <- new("GDALTransientDataset", driver = d.drv, rows =
>> dims[2],cols = dims[1], bands = bands, type = type)
>> gt <- c(offset[1] - 0.5 * cellsize[1], cellsize[1], 0.0,offset[2] +
>> (dims[2] -0.5) * cellsize[2], 0.0, -cellsize[2])
>> .Call("RGDAL_SetGeoTransform", tds.out, gt, PACKAGE = "rgdal")
>> .Call("RGDAL_SetProject", tds.out, file_projection, PACKAGE = "rgdal")
>> fn <- tempfile()
>> saveDataset(tds.out, fn)
>>
>> Thanks!
>>
>> --j
>>
>>
>>
>
--
Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Cell: 415-794-5043
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307
More information about the R-sig-Geo
mailing list