[R-sig-Geo] raster values disappear in polygonsToRaster

Jochen Albrecht jochen at hunter.cuny.edu
Mon Nov 22 05:52:37 CET 2010


This is an odd one. I have used polygonsToRaster repeatedly and 
successfully.
But this evening I am stumped by the fact that the raster values are 
properly reported as part of the function output but seem not to make it 
into the raster object. What went wrong here?
Cheers,
     Jochen

 > polygonsToRaster(UE_spdf, UE2rot, field=2, updateRaster=FALSE)
Found 7050 region(s) and 14648 polygon(s)
class       : RasterLayer
filename    : C:/Temp/R_raster_tmp/raster_tmp_56110763822.grd
nrow        : 3600
ncol        : 7200
ncell       : 25920000
min value   : 53
max value   : 94649
projection  : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs 
+towgs84=0,0,0
xmin        : -180
xmax        : 180
ymin        : -90
ymax        : 90
xres        : 0.05
yres        : 0.05

 > plot(UE2rot, col='red')
Error in .plotraster(x, col = col, maxpixels = maxpixels, ...) :
   no values associated with this RasterLayer

 > UE2rot
class       : RasterLayer
filename    :
nrow        : 3600
ncol        : 7200
ncell       : 25920000
min value   :
max value   :
projection  : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs 
+towgs84=0,0,0
xmin        : -180
xmax        : 180
ymin        : -90
ymax        : 90
xres        : 0.05
yres        : 0.05



More information about the R-sig-Geo mailing list