[R-sig-Geo] writeRaster issue

Guillermo E. Ponce-Campos geponce at gmail.com
Tue Apr 22 20:09:33 CEST 2014


Hi:

Is there any known issue on using writeRaster under Windows vs Linux?

I have been trying to write a rasterlayer as a geotif in a Linux
(centos) machine with no success...

I have this raster layer:

> varTmpRaster
class       : RasterLayer
dimensions  : 720, 1440, 1036800  (nrow, ncol, ncell)
resolution  : 0.25, 0.25  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84
+no_defs +towgs84=0,0,0
data source : in memory
names       : layer
values      : 0, 0.9132664  (min, max)

>plot(varTmpRaster)
It shows everything right...

When I run the writeRaster the resulting file only have NA's:

>tf <- writeRaster(varTmpRaster, "testGeoTif", format="GTiff", overwrite=TRUE)
>plot(tf)
Just blank plot...

>length(tf)
[1]1036800
>length(tf[is.na[tf])
[1] 1036800


If I run the exact same instructions on R for Windows7 and everything
goes fine, both plots, the one from varTmpRaster and the tf show
exactly the same map...

Here are the characteristics from both machines...

Linux-Centos:
---------------
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
rgdal: version: 0.8-16, (SVN revision 498)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
Path to GDAL shared files: /usr/local/share/gdal
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: /opt/source/proj-4.8.0/nad

Windows 7:
----------------
R version 3.0.1 (2013-05-16) -- "Good Sport"
Loading required package: sp
rgdal: version: 0.8-11, (SVN revision 479M)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.9.2, released 2012/10/08
Path to GDAL shared files: C:/Program Files/R/R-3.0.1/library/rgdal/gdal
GDAL does not use iconv for recoding strings.
Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
Path to PROJ.4 shared files: C:/Program Files/R/R-3.0.1/library/rgdal/proj

Does anyone has seen a thread commenting on an issue like this before ?

I have tried the NAvalue() and also using the datatype FLT8S and FLT4S
as part of the parameters of the writeRaster but no luck.


Thanks,
Guillermo



More information about the R-sig-Geo mailing list