[R-sig-Geo] raster: file not saved and data type changed
Agustin Lobo
alobolistas at gmail.com
Thu Aug 9 13:35:13 CEST 2012
Hi!
I'm doing this:
> delme <- subset(adlstest,c("B48","B31","B21"),filename="delme",format="GTiff",dataType="INT2U")
> adlstest
class : RasterBrick
dimensions : 33, 33, 1089, 196 (nrow, ncol, ncell, nlayers)
resolution : 29.9746, 29.99077 (x, y)
extent : 643485, 644474.2, 7053615, 7054605 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=19 +south +datum=WGS84 +units=m +no_defs
+ellps=WGS84 +towgs84=0,0,0
values : in memory
layer names : B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18,
B19, B20, B21, B22, ...
min values : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
max values : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
and the object is correctly created but the file is not saved to disk
If I do:
> writeRaster(delme,filename="delme",format="GTiff",dataType="INT2U")
class : RasterBrick
dimensions : 33, 33, 1089, 3 (nrow, ncol, ncell, nlayers)
resolution : 29.9746, 29.99077 (x, y)
extent : 643485, 644474.2, 7053615, 7054605 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=19 +south +datum=WGS84 +units=m +no_defs
+ellps=WGS84 +towgs84=0,0,0
values : /media/Iomega_HDD/VOLCAN/HYPERION/RHyperion/delme.tif
layer names : delme.1, delme.2, delme.3
min values : 0, 0, 0
max values : 0, 0, 0
I get the file but note that the data type is not the one I set:
> GDALinfo("delme.tif")
rows 33
columns 33
bands 3
origin.x 643485
origin.y 7053615
res.x 29.9746
res.y 29.99077
ysign -1
oblique.x 0
oblique.y 0
driver GTiff
projection +proj=utm +zone=19 +south +datum=WGS84 +units=m +no_defs
file delme.tif
apparent band summary:
GDType Bmin Bmax Bmean Bsd hasNoDataValue NoDataValue
1 Float32 0 0 0 0 TRUE -3.4e+38
2 Float32 0 0 0 0 TRUE -3.4e+38
3 Float32 0 0 0 0 TRUE -3.4e+38
Metadata:
AREA_OR_POINT=Area
A bug or am I doing something wrong?
File in
http://dl.dropbox.com/u/3180464/adlstest.rda
Agus
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=C LC_NAME=C
LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgdal_0.7-5 raster_2.0-08 sp_0.9-99
loaded via a namespace (and not attached):
[1] grid_2.1
More information about the R-sig-Geo
mailing list