1

I am trying to mosaic very large rasters in R. My code, taken from this helpful answer, worked perfectly for 3 test rasters (50 MB, 50 MB, 120 MB), but when I tried a larger test on 7 rasters (ranging from 1 MB to 400 MB) I returned an error.

setwd("~/raster_tiles")

gdalbuildvrt(gdalfile = "*.tif", # uses all tiffs in the current folder
             output.vrt = "test.vrt")


gdal_translate(src_dataset = "test.vrt", 
               dst_dataset = "test.tif", 
               output_Raster = TRUE, # returns the raster as Raster*Object
               # if TRUE, you should consider to assign 
               # the whole function to an object like dem <- gddal_tr..
               options = c("BIGTIFF=YES", "COMPRESSION=LZW"))

Error in .local(.Object, ...) : 

In addition: Warning message:
In system(cmd, intern = TRUE) :
  running command '"C:\Program Files\QGIS 2.18\bin\gdal_translate.exe" -of "GTiff" "geom1to7test.vrt" "geom1to7test.tif"' had status 1
Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) : 
  Cannot create a RasterLayer object from this file. (file does not exist)

I can see a .vrt file in my folder of ~19 MB, but can't seem to return a GeoTIFF. Does it only have to do with the file size when I use gdal_translate on more and bigger rasters? Any suggestions?

2
  • did you solve it ? Nov 3, 2020 at 15:06
  • No, unfortunately.
    – rachell
    Nov 18, 2020 at 17:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy