Hi Augustin,
Could it be because of the typo in the code ("dataype")?
Cheers,
Lo?c
-----Original Message-----
From: r-sig-geo-bounces at r-project.org [mailto:r-sig-geo-bounces at r-project.org] On Behalf Of Agustin Lobo
Sent: jeudi 11 juillet 2013 15:19
To: r-sig-geo
Subject: [R-sig-Geo] writeRaster() writing float despite stating INT2U
I'm having this strange problem: I write a raster as INT2U but get a geotif with Float64. Is perhaps a gdal problem?
r <- raster(matrix(1:100,nrow=10,ncol=10))
writeRaster(r,
file="r.tif",format="GTiff",dataype="INT2U",overwrite=TRUE,NAflag=0)
rgdal: version: 0.8-10, (SVN revision 478) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 1.10.0, released 2013/04/24 Path to GDAL shared files: /usr/share/gdal/1.10 Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480] Path to PROJ.4 shared files: (autodetected)
class : RasterLayer
dimensions : 10, 10, 100 (nrow, ncol, ncell) resolution : 0.1, 0.1 (x, y)
extent : 0, 1, 0, 1 (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : /media/alobo/Iomega_HDD/PIVOT/RPivot/r.tif
names : r
values : 1, 100 (min, max)