The following code does not put the last file in the list on top, as it says in the description of the doc:

"If there is some amount of spatial overlapping between files, the order of files appearing in the list of source matter: files that are listed at the end are the ones from which the content will be fetched. Note that nodata will be taken into account to potentially fetch data from less priority datasets, but currently, alpha channel is not taken into account to do alpha compositing (so a source with alpha=0 appearing on top of another source will override is content). This might be changed in later versions."

I tried both AddAlpha True and False, True gives me an all green image. When I put the last file as the first element of the list it only appears in the vrt. It works with gdalWarp and SagaMosaicking, but I would prefer buildVRT for it's fantastic speed and efficiency.

list = [r"D:\path\QGIS\vrt\raster_name.tif",

gdal.BuildVRT(r'%s/vr.vrt'%proj, list)

Related posts that did not make me see the error: How can I create an aggregate GDAL dataset with a specific ordering for overlapping regions?

gdalbuildvrt vs gdal_merge on overlapping images

1 Answer 1


The problem was that the images had differing numbers of bands. It also seems that VRTs cannot be mixed with TIFs into a new VRT. Using only vrt's as input, the last shows up on top as promised.

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.