[gdal-dev] [Python bindings] BuildOverviews() not supported for VRT dataset
Even Rouault
even.rouault at spatialys.com
Fri Feb 7 03:32:21 PST 2020
On vendredi 7 février 2020 03:58:02 CET umbertofilippo wrote:
> Solved by looking at this answer
> <https://gis.stackexchange.com/questions/44003/python-equivalent-of-gdalbuil
> dvrt/299218>
>
>
> out_vrt = os.path.join(out_dir, 'mosaic.vrt')
> ds = gdal.BuildVRT(out_vrt, [raster1.tif, raster2.tif])
> ds = None # this did the trick!
> factors = [128, 256, 512]
> gdal.SetConfigOption('COMPRESS_OVERVIEW', 'DEFLATE')
> ds.BuildOverviews("AVERAGE", factors)
The above will obviously not work :-) ! You cannot call ds.BuildOverview()
when ds is set to None before.
I suspect you've added in-between a
ds = gdal.Open(out_vrt, gdal.GA_Update)
But having to close / re-open was a bug that I've just fixd. Your original
code would now work.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list