[R-sig-Geo] wrong stats in GTiff files made with writeRaster() (through rgdal?)

Agustin Lobo alobolistas at gmail.com
Fri Aug 10 10:25:14 CEST 2012


I've just noted that files created with writeRaster() have wrong stats
(which is a problem later in Qgis, for example).
Not sure if writeRaster() uses rgdal, in that case the problem might
be more general:

> delme <- subset(adlstest,c("B48","B31","B21"))
> summary(delme)
Cells:  1089
NAs  :  0 0 0

           1    2    3
Min.    2563 3491 3822
1st Qu. 2700 3636 3971
Median  2764 3691 4009
Mean    2781 3699 4014
3rd Qu. 2862 3765 4055
Max.    3629 3979 4258

> GDALinfo("delme.tif")
rows        33
columns     33
bands       3
origin.x        648490.8
origin.y        7058623
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 2563 3629     0   0           TRUE           0
2 Float32 3491 3979     0   0           TRUE           0
3 Float32 3822 4258     0   0           TRUE           0
Metadata:
AREA_OR_POINT=Area

Note the 0 means and sd !

adlstest here:
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.15.1     lattice_0.19-30 tools_2.15.1



More information about the R-sig-Geo mailing list