Merging multiple rasters in R

后端 未结 7 1248
傲寒
傲寒 2021-02-01 19:43

I\'ve been trying to find a time-efficient way to merge multiple raster images in R. These are adjacent ASTER scenes from the southern Kilimanjaro region, and my target is to pu

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-01 20:01

    You can use do.call

    ast14dmo.sd$tolerance <- 1
    ast14dmo.sd$filename <- paste(path.mrg, "/AST14DMO_sd_", z, "m_mrg.tif", sep = "")
    ast14dmo.sd$overwrite <- TRUE
    mm <- do.call(merge, ast14dmo.sd)
    

    Here with some data, from the example in raster::merge

    r1 <- raster(xmx=-150, ymn=60, ncols=30, nrows=30)
    r1[] <- 1:ncell(r1)
    r2 <- raster(xmn=-100, xmx=-50, ymx=50, ymn=30)
    res(r2) <- c(xres(r1), yres(r1))
    r2[] <- 1:ncell(r2)
    
    x <- list(r1, r2)
    names(x) <- c("x", "y")
    x$filename <- 'test.tif'
    x$overwrite <- TRUE
    m <- do.call(merge, x)
    

提交回复
热议问题