[R-sig-Geo] Mask() in raster package only returns RasterLayers not RasterStack or RasterBrick
Robert Buitenwerf
buitenwerf at em.uni-frankfurt.de
Tue Sep 27 15:32:32 CEST 2011
Dear members,
I am very happily using the raster package but here is a problem I can't
solve.
When I use the mask function on a RasterBrick or RasterStack:
raster_mask <- mask( raster_stack, SpatialPolygonDataFrame)
raster returns a RasterLayer and gives me a warning:
"In .rasterFromRasterFile(grdfile, band = band, objecttype) : size of
values file does not match the number of cells (given the data type)"
When I use mask on a single layer from a brick or stack (e.g. mask(
RasterStack[1], SpatialPolygon*) ) it returns a correctly masked
rasterlayer.
I am trying to mask with a SpatialPolygonDataFrame, read in with
readShapePoly of the maptools package.
R version 2.13.0 (2011-04-13)
Platform: x86_64-pc-mingw32/x64 (64-bit)
I am sure I missed something simple and I hope someone would point it
out to me.
Thanks,
Robert
More information about the R-sig-Geo
mailing list