[R-sig-Geo] More questions on setting up ENVI headers...
Jonathan Greenberg
greenberg at ucdavis.edu
Fri Jul 10 05:46:56 CEST 2009
R-sig-geo'ers:
I am using the following code to create an ENVI header:
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])
print(gt)
.Call("RGDAL_SetGeoTransform", tds.out, gt, PACKAGE = "rgdal")
.Call("RGDAL_SetProject", tds.out, file_projection, PACKAGE = "rgdal")
fn <- tempfile()
saveDataset(tds.out, fn)
GDAL.close(tds.out)
gt prints out to be:
[1] 736801.7 30.0 0.0 4447309.0 0.0 -30.0
The issue I'm having is that the output header, while containing the
correct projection, is not saving out the pixel sizes, an upper left
coordinates (e.g. I'm not getting RGDAL_SetGeoTransform to work
correctly). Here's the text of the output header:
ENVI
description = {
/var/folders/-Y/-Yv+caBK2RaJhU+8ZQAOk++++TQ/-Tmp-//RtmpX7PvqQ/file4431b782}
samples = 1172
lines = 2810
bands = 7
header offset = 0
file type = ENVI Standard
data type = 4
interleave = bsq
byte order = 0
map info = {UTM, 1, 1, 0, 0, 1, 1, 10, North,North America 1983}
band names = {
Band 1,
Band 2,
Band 3,
Band 4,
Band 5,
Band 6,
Band 7}
Thoughts?
--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