2

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)?

1
  • 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
    Commented Jan 10, 2017 at 3:51

1 Answer 1

5

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

Note: this requires a raster VRT input. If you try to use a vector VRT you will get an error:

ERROR 4: 'in.vrt' not recognized as a supported file format.

Vector VRTs need to be rasterized.

0

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.