[gdal-dev] Removing in-file overviews

Even Rouault even.rouault at spatialys.com
Thu Sep 8 11:02:33 PDT 2016


Le jeudi 08 septembre 2016 18:40:48, Michael Aschenbeck a écrit :
> Hello GDAL developers,
> 
> For my application I need to create an *.ovr file, and it usually works
> using BuildOverviews.
> 
> However, when I call BuildOverviews via C++ on a certain dataset, nothing
> happens because the overview is already included in the file.  Is it
> possible to delete the in-file overview or move it to an *.ovr file using
> the C++ API?

Mike,

Deleting overviews depends on the file format. Works for TIFF for example. You 
can call BuildOverviews() with nOverviews == 0 and panOverviewList == NULL to 
clear existing overviews (I realize this isn't yet documented in the API. 
That's what gdaladdo -clean does : 
https://github.com/OSGeo/gdal/blob/trunk/gdal/apps/gdaladdo.cpp#L240), 
assuming you've open the file in GA_Update mode.

Note that in the case of TIFF, this will not recover file space (you'll need to 
do a gdal_translate to do that), but just make the previous content no longer 
accessible.

Then you should be able to call BuildOverviews() on the file opened in 
GA_ReadOnly mode to build external overviews.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list