[R-sig-Geo] Create raster based on overlapping

Thiago Veloso thi_veloso at yahoo.com.br
Wed Aug 8 15:17:27 CEST 2012


 Dear all,
  
 I have two rasters: r1 is a 0.5 degree netcdf file produced by a vegetation model. r2 is a 30m shapefile which I rasterized to a raster with the same 30m resolution. r2 values are all NA and 1.

 Please see below:

> r1
class       : RasterLayer 
dimensions  : 10, 18, 180  (nrow, ncol, ncell)
resolution  : 0.5, 0.5  (x, y)
extent      : -53, -44, -25, -20  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
values      : in memory
layer name  : variable 
zvar        : variable 

> r2
class       : RasterLayer 
dimensions  : 14469, 22190, 321067110  (nrow, ncol, ncell)
resolution  : 0.0002702699, 0.0002702702  (x, y)
extent      : -52.60649, -46.6092, -23.7172, -19.80666  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
values      : in memory
layer name  : cs_2005spx1 
min value   : 1 
max value   : 1 

 Here you can see a join plot: http://img855.imageshack.us/img855/2820/plotzoom.png

 Is it possible to create a new raster, which is composed only by r1 cells which are "touched" by r2 cells?




More information about the R-sig-Geo mailing list