[R] raster package: merge/mosaic

Nora Ernst nora-ern at gmx.ch
Wed Oct 23 16:40:17 CEST 2013


   Hi all,

   I'm working with raster data (satellite imagery) and the raster package. The
   idea is to merge two raster files that are partially overlaping, do have the
   same coordinate system and resolution but not the same origin. As expected,
   the functions mosaic(r1,r2) as well as merge(r1,r2)) give the error message:

Error in compareRaster(x, extent = FALSE, rowcol = FALSE, orig = TRUE,  : 
  different origin


> extent(r1)
class       : Extent 
xmin        : 24.14369 
xmax        : 37.81287 
ymin        : -31.1356 
ymax        : -14.72525 
> extent(r2)
class       : Extent 
xmin        : 26.80423 
xmax        : 42.15502 
ymin        : -19.33202 
ymax        : -7.643101

> origin(r1)
[1] 5.582522e-05 1.124150e-03
> origin(r2)
[1]  0.001054868 -0.001124150


   Can  anyone tell me how it is possible to merge rasters with different
   origin?

   Thanks in advance.


More information about the R-help mailing list