I have made a VRT out of a few different single band rasters. I've played around with it in QGIS and it's great and I can do a save as and it'll become a real raster. To do further processing in the pipeline, the files need to be tif files, not a VRT.

How can I batch convert VRTs to real rasters?

Ideally It'd be using command line gdal utilities but I can do it in python too if that's easier.

Or conversely, is there any easier way to just stack rasters (with potentially non-overlapping cell sizes)?

  • If you're looking for command line syntax to batch process files, you need to specify what command line environment you are using, Windows CMD, Powershell, Linux/OSX BASH etc... If you are after batch syntax, then your question is probably a duplicate of gis.stackexchange.com/q/54819/2856 – user2856 Jan 10 '17 at 3:51

To perform the conversion to GeoTIFF:

gdal_translate in.vrt out.tif

See the gdal_translate help and the GeoTIFF driver documentation for various other arguments and config options to control the conversion, such as whether to compress the output.

For stacking, look at gdalbuildvrt.

Something like:

gdalbuildvrt -separate stacked.vrt [in vrts or rasters]
gdal_translate stacked.vrt stacked.tif
  • using gdal_translate in.vrt out.tif I get ERROR 4: 'in.vrt' not recognized as a supported file for mat. – user32882 Nov 9 '18 at 15:20

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.