#' Process a directory of image files and stitch them together to form a single, large, raster.
#'
#' @param wd The directory containing tiles to stitch.
#' @param filetype File extension of the files to be stitched.
#' @param fun Function to use if cells overlap at tile borders. Can be min, max or mean.
#' @return Returns a single Raster object.
#' @seealso split_raster
#' @export
#' @examples Coming soon.
stitch_tiles<-function(wd, filetype="tif", fun=mean){
setwd(wd)
temp<-list.files(pattern=paste0("*.",filetype))
rast.list<-list()
for(i in 1:length(temp)) {
rast.list[[i]] <- raster(temp[i])
}
merged<-do.call(mosaic, c(rast.list, fun=fun))
return(merged)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.