I am trying to create a warped VirtualRaster of a Sentinel2 image. Here the Python code I tried:
from osgeo import gdal, osr srs = osr.SpatialReference() srs.SetFromUserInput('EPSG:32632') gdal.UseExceptions() d = gdal.Open('SENTINEL2_L1C:S2A_OPER_MTD_SAFL1C_PDMC_20160506T205836_R122_V20160506T100527_20160506T100527.xml:10m:EPSG_32632') vrt = gdal.AutoCreateWarpedVRT(d, None, srs.ExportToWkt()) gdal.GetDriverByName('VRT').CreateCopy('test.vrt', vrt)
AutoCreateWarpedVRT command actually succeedes, i.e. the returned dataset can be effectively used to read data and metadata.
The problem arises with the last command, which raises the following exception:
RuntimeError: No such file or directory
Please notice that:
test.vrtfile is actually created and filled, but
gdal.Openraises the very same error as above (I suspect that the error raised by
CreateCopyis actually raised by an internal
- If I inject some error in the XML,
gdal.Openraises a different exception, which is actually related to the injected error.
gdal_translateand QGIS can successfully read
- The procedure does work as expected if, instead of a SENTINEL2 image, I use LANDSAT8 (i.e. plain GeoTIFF) data.
I am using Ubuntu 14.04 with GDAL-2.1.0 compiled by myself with the flags
--with-dods-root=/usr --with-ogdi=no (of course,
gdal_translate and QGIS are also compiled and ran with the same build).