1

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.

Michael Davidson
  • 1,391
  • 1
  • 14
  • 31
  • 3
    This question is probably better suited to [gis.se], but yes, you are right in thinking the rasters must have a common CRS. For speed, you might consider using `gdalwarp`, either from the command line, or from the `gdalUtils` package. See also this [ESRI forum thread](http://forums.esri.com/Thread.asp?c=93&f=995&t=245941). – jbaums Mar 26 '15 at 23:51

1 Answers1

0

help(mosaic) clearly states:

All objects must have the same origin, resolution, and coordinate reference system.

Two different UTM zones are not considered to have the same reference system (the parameters are different when you look under the hood: false easting, false northing, reference meridians, etc.).

They should be reprojected to the output CRS, which should be a reference system that will be cartographically valid for a larger area, rather than continuing to use a single UTM zone, which will eventually show distortions, etc. when mapping larger areas.

Benjamin
  • 11,560
  • 13
  • 70
  • 119