[R-sig-Geo] problem with writeRaster and GeoTIFF format

lancelot renaud.lancelot at cirad.fr
Fri May 10 20:57:02 CEST 2013


Dear all,

I have a raster

 > r
class       : RasterLayer
dimensions  : 1639, 821, 1345619  (nrow, ncol, ncell)
resolution  : 0.00887, 0.00833  (x, y)
extent      : 43.21786, 50.50013, -25.60209, -11.94922  (xmin, xmax, 
ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84
data source : in memory
names       : layer
values      : 15.3815, 38.32809  (min, max)

I cannot write it to a GeoTIFF file:

 > writeRaster(r, filename = "r.tif")
Error in .local(.Object, ...) : Unable to create dataset

The same thing happens after converting the raster to 
SpatialGridDataFrame and using writeGDAL

 > r.sgdf <- as(r, Class = "SpatialGridDataFrame")
 > writeGDAL(dataset = r.sgdf, fname = "r.tif", drivername = "GTiff")
Error in .local(.Object, ...) : Unable to create dataset

I can write the raster to other formats (e.g. ESRI .hdr labelled). I can 
also reproduce the .tif example in ?writeRaster.

Any hint?

Best wishes,

Renaud

 > sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252 
LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods 
   base

other attached packages:
[1] maptools_0.8-23 lattice_0.20-15 foreign_0.8-53  mapdata_2.2-2 
maps_2.3-2      raster_2.1-25   rgdal_0.8-9
[8] sp_1.0-9

loaded via a namespace (and not attached):
[1] compiler_3.0.0 fortunes_1.5-1 tools_3.0.0
 >


-- 
Renaud Lancelot
Directeur adjoint / Deputy director
CIRAD, UMR15, Campus International de Baillarguet TA A-DIR / B
F34398 Montpellier

EDENext Project, coordinator: http://www.edenext.eu/

Tel.  +33 4 67 59 37 17  -  Fax  +33 4 67 59 37 98
Secr. +33 4 67 59 37 37  - Cell. +33 6 77 52 08 69



More information about the R-sig-Geo mailing list