[gdal-dev] CreateCopy() does not copy overviews of dataset?
Matsamentet
mbu at teleplan.no
Thu May 16 00:18:47 PDT 2019
Hi all!
I'm trying to do the following using Python: Take a GeoTIFF file as input,
and build an in-memory GeoPackage. Then build overviews on the GeoPackage,
and finally writing it out to disk.
Before the last step, I have confirmed that the dataset contains overviews
by using GetOverviewCount() on one of its bands. I then use CreateCopy() to
write the dataset to file, but the file which is written does not contain
any overviews. Is this the intended behaviour of CreateCopy() ? If so, is
there another way to go about this?
This is my code:
---
srcfile = 'input.tif'
outputvsimem = '/vsimem/output.gpkg'
warpoptions = gdal.WarpOptions(format='GPKG',
warpOptions='SKIP_NOSOURCE=YES', \
dstAlpha=False, multithread=True)
gpkg = gdal.Warp(outputvsimem, srcfile, options=warpoptions)
overviews = [2,4,8,16,32,64,128]
gpkg.BuildOverviews('AVERAGE',overviews)
gpkgdriver = gdal.GetDriverByName('GPKG')
outputdataset = gpkgdriver.CreateCopy(outputfile, gpkg, strict=0)
outputdataset = None
gpkg = None
gdal.Unlink(outputvsimem)
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list