I am trying to merge seven tiles of raster in R version 4.0.3 but it shows error as:
Error in compareRaster(x, extent = FALSE, rowcol = FALSE, orig = TRUE, :
different origin.
The origin of raster are:
> origin(f1)
[1] 1.549293 0.000000
> origin(f2)
[1] 1.666904 2.306145
> origin(f3)
[1] 0.02155916 -0.67734774
> origin(f4)
[1] 2.921843 4.800345
> origin(f5)
[1] -2.036317 -1.870532
> origin(f6)
[1] 3.293903 4.393251
> origin(f7)
[1] -0.3293477 -0.2457405
and I tried tolerance=0.1
but its still showing the same error.
The R code is here:
library(raster)
merge_forest <- raster::merge(f1,f2,f3,f4,f5,f6,f7,tolerance=0.1)
These are the raster tiles of landcover(https://www.arcgis.com/apps/instant/media/index.html?appid=fc92d38533d440078f17678ebc20e8e2&fbclid=IwAR3Y3SN7iyaPrzViPzagVH086dZTygvmwoIdZrudbb4EJlJyZOf6zdA13g4).
I downloaded seven tiles that covers the area of Norway and wanted to merge it together and clip it to the extent of Norway.
merge(f1,f2,f3,...)
?) and complete code (includinglibrary(raster)
so we know whatmerge
you are using) and more information about your data than just theorigin
(summary
is usually a good idea). You can only merge if data has the same origin and resolution. Yours don't.do.call(mosaic, list(f1, f2, f3, f4, f5, f6, f7))