Is there a way to perform the same task as the gdalbuildvrt utility using GDAL Python bindings? So far I have not found any way to do this other than creating a vrt of a single dataset and manually editing the xml. I would like to create a vrt from multiple rasters (essentially performing a mosaic). Is this possible using pure Python? My other option is to use subprocess to simply call gdalbuildvrt.
Should you wish to do this through Python it can be done. Using the standard dataset creation methods within GDAL Python we can easily create the base dataset VRT.
Note that we are creating the dataset with no bands initially. From the documentation on VRTs that VRT datasets are one of the few dataset types that can accept
Now for each band we have to set the metadata items manually:
Note that we can use this method to create complex sources (