I am trying to use gdalbuildvrt to create a time series of landsat images. I used the following code but it is not outputting the vrt file.

In the code inlist is the txt file with path to input image. However, if I list the individual tif files itself it would work. Any suggestion on what i am doing wrong?

enter image description here

Inlist txt file

  • 3
    Please use text with code formatting (the "{}" button above the question entry text area) not screenshots.. – user2856 May 19 '16 at 23:05

You are getting a return value of 1 - which means an error of some sort.

Try using subprocess.check_output or subprocess.check_call so you get an exception raised if the command fails, you'll get a bit more about why it fails if you do this.

A couple of possible problems:

You are not passing the filepaths, you are passing the literal strings "inlist" and "outVRT". Use inlist and outVRT (note lack of quotes) instead.

Your subprocess call will also fail if gdalbuildvrt isn't located in one of the directories in your PATH environment variable. If that is the reason your command is failing, either pass the full path to gdalbuildvrt, or use os.environ to append the gdalbuildvrt directory to your PATH.


subprocess.check_call([r"C:\Path\to\gdalbuildvrt", "-separate", "-input_file_list", inlist, outVRT])


os.environ['PATH'] = ';'.join(r'c:\Path\to\gdal\bin\directory',os.environ['PATH'])
subprocess.check_call([r"gdalbuildvrt", "-separate", "-input_file_list", inlist, outVRT])

Your Answer

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

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