I'm trying to use the mosaic
function (package: raster
) in R to join two geo-tiff rasters together. Both are derived from LandSat tiles. I understand that mosaic requires
All objects must have the same origin, resolution, and coordinate reference system.
Unfortunately, the two tiles have different CRS
+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
and
+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
leading to
Error in compareRaster(x, extent = FALSE, rowcol = FALSE, orig = TRUE, :
different CRS
So, I converted them to the same crs by using projectRaster
- I've tried reprojecting both rasters to both epsg:3857 and epsg:4326
However, having done this, in both cases when I run the mosaic
function I get the error
Error in compareRaster(x, extent = FALSE, rowcol = FALSE, orig = TRUE, :
different origin
How can I fix this? Is there a different crs I could use that would use the same origin for both?