I have a list of rasters which I would like to mosaic together. The projection is the same except for the utm zone. Here is the coord line from one rasterStack in UTM zone 50:
coord. ref. : +proj=utm +zone=50 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
Here is another rasterStack with an identical projection, save it is UTM zone 51:
coord. ref. : +proj=utm +zone=51 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
When I try to mosaic without reprojecting first (as you can in other GIS), I get the following error:
rMosaic <- do.call(mosaic,rStacks)
Error in compareRaster(x, extent = FALSE, rowcol = FALSE, orig = TRUE,: different CRS
This leads me to believe I need to reproject all of the rasterStacks. This is computationally time consuming with projectRaster
, but I believe I can do it as follows:
for(i in 2:length(rStacks)){
rStacks[[i]] <- projectRaster(from=rStacks[[i]], to=rStacks[[1]])
}
Am I right to assume I have to re-project first? Thanks for any direction.