[R-sig-Geo] writeRaster() writing float despite stating INT2U
Agustin Lobo
alobolistas at gmail.com
Thu Jul 11 18:07:04 CEST 2013
LLoic,
Thanks and I apologize!
Agus
On Thu, Jul 11, 2013 at 4:46 PM, Dutrieux, Loic <loic.dutrieux at wur.nl> wrote:
> 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)
>
>> GDALinfo("r.tif")
> rows 10
> columns 10
> bands 1
> lower left origin.x 0
> lower left origin.y 0
> res.x 0.1
> res.y 0.1
> ysign -1
> oblique.x 0
> oblique.y 0
> driver GTiff
> projection NA
> file r.tif
> apparent band summary:
> GDType hasNoDataValue NoDataValue blockSize1 blockSize2
> 1 Float64 TRUE 0 10 10
> apparent band statistics:
> Bmin Bmax Bmean Bsd
> 1 1 100 50.5 29.01149
>
>> sessionInfo()
> R version 2.15.2 (2012-10-26)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> LC_TIME=es_ES.UTF-8 LC_COLLATE=en_US.UTF-8
> LC_MONETARY=es_ES.UTF-8
> [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=C LC_NAME=C
> LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] rgdal_0.8-10 raster_2.1-37 sp_1.0-9
>
> loaded via a namespace (and not attached):
> [1] grid_2.15.2 lattice_0.20-13 tools_2.15.2
>
> Agus
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list