Skip to content

Instantly share code, notes, and snippets.

@gisma
Last active December 12, 2021 17:11
Show Gist options
  • Save gisma/5127a360728666eddb96807ad37bb475 to your computer and use it in GitHub Desktop.
Save gisma/5127a360728666eddb96807ad37bb475 to your computer and use it in GitHub Desktop.
get_vrt_img = function(name,path,tag,rasterStack = TRUE) {
fList = list.files(path,
pattern = glob2rx(paste0("*",tag,".tif")),
full.names = TRUE)
gdalUtils::mosaic_rasters(gdalfile = fList,
output_Raster = TRUE,
dst_dataset = paste0(path,name,".tif"))
if (rasterStack) return(raster::stack(paste0(path,name,".tif")))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment