I am creating multiple QgsRasterLayer objects in pyqgis and I need to merge them into a virtual raster .vrt file which will eventually be loaded as a layer in QGIS. The QgsRasterLayer objects are being created by passing imagery urls.

From what I could gather, I need to use gdalbuildvrt as mentioned at https://www.gdal.org/gdalbuildvrt.html but there the .vrt file is being created through list of .tif files.

I also checked the solution at pyQGIS Merge raster layers but there too they are loading the raster layers through .tif files.

Do I need to create .tif files from all the raster layer objects (as mentioned in Exporting raster to rendered image using standalone script in QGIS?) and then use them to create .vrt or is there some other way to achieve this?

Your Answer

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

Browse other questions tagged or ask your own question.