I want to make a mosaic out of several raster files that are next to each other, all including 4 bands. Due to saving space on the server I need to build a vrt and want to write the code in R, so I can process this action more often without too much work. Unfortunately I cannot get rid of the Warning message:

    Warning message:
    running command '"C:\Program Files\QGIS 2.16\bin\gdalbuildvrt.exe"  
    "S:/Raster/Ortho_Mosaic.vrt" "S:/Raster/Input/*.tiff"'    
    had status 1 

I use R and gdalbuildvrt should use gdal from QGIS 2.16.

My packages are rgdal, raster and gdalUtils. My code looks like this:

    folder <- 'S:/Raster/'
    gdalbuildvrt(gdalfile = paste(folder, '/Input/*.tiff', sep = ""),
    output.vrt= paste(folder, '/Ortho_Mosaic.vrt', sep = ""), 
    intern = TRUE, overwrite = TRUE))

I tried a lot of different ways for my input files: use an extent, use single files, all .tif files or changed tif to tiff ... The output file is not produced even though it is only a warning and not an error message. All files are in the same coordinate system; EPSG 31467

Does anyone have an idea what the problem could be?

  • 1
    Do you have success by using the gdalbuildvrt command directly from the command line?
    – user30184
    Commented Mar 1, 2018 at 7:45
  • Thanks for your answer. It worked immediately. I would just prefer it to work in R because then the script can be used as some kind of documentation and within a big group of people working on similar data it would be benificial to use the exact same method. Do you have any idea why command line is no problem at all and in R i cannot make it work? Might there be any issue in R? Thanks for your help again.
    – Li12
    Commented Mar 1, 2018 at 9:55
  • Is Orhto_Mosaic.vrt a typo in your question or in your script?
    – user30184
    Commented Mar 1, 2018 at 10:03
  • Oh yes, sorry. Unfortunately just in the question... Thanks for the tip!
    – Li12
    Commented Mar 1, 2018 at 10:07
  • Warning messages are not supposed to be critical. Have you checked if new .vrt file is generated anyhow?
    – user30184
    Commented Mar 1, 2018 at 10:23

2 Answers 2


I changed my code a bit and it looks like I had problem with the paths. I am not sure though if this warning (/error) message is a sign in general that the path is wrong.

My paths look now like this with less frontslashes:

    folder_lisa_2015 <-'S:/Raster/'
    gdalbuildvrt(gdalfile = paste(folder, 'Input/*.tif', sep = ''), 
    output.vrt= paste(folder_lisa_2015, 'Ortho_Mosaic.vrt'), intern = TRUE, 
    overwrite = TRUE)

If it would not be for so many files, I would prefer the nice solution by @user30184 and process the mosaic in command line!


In my case, the following worked:

gdalbuildvrt <- system2(
                    args=c( "/path/to/mosaic.vrt", "/path/to/*.tif" )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.