Ticket #2915 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Need Mechanism to Clear Overviews

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 1.7.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: overviews
Cc: gaopeng

Description

GDAL needs a mechanism to clear existing overviews.

It is planned to treat the case of passing an empty list of overview levels to BuildOverviews?() to indicate that any existing overviews should be cleared.

Attachments

pyramids93.zip Download (0.6 MB) - added by gaopeng 4 years ago.
A smaller sample dataset

Change History

Changed 4 years ago by warmerdam

I have added an initial implementation which implements BuildOverviews?(0) to clear overviews in the HFA, and GTiff drivers, as well as in the gdaldefaultoverviews class and adds a -clear option to gdaladdo. This is in trunk (r16670).

No regression tests yet...

Changed 4 years ago by warmerdam

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.7.0

I have added testing in trunk for the clear overviews functionality (r16697).

Changed 4 years ago by warmerdam

These changes (r16670 and r16697) have been migrated into the 1.6-esri branch (r17184) with tests and the tiff_ovr.py script passes

Changed 4 years ago by gaopeng

  • status changed from closed to reopened
  • resolution fixed deleted

BuildOverviews? on a tiff (or other formats such as Grid) with an existing RRD is broken. It now just deletes the existing rrd without building any overviews.

Changed 4 years ago by gaopeng

A smaller sample dataset

Changed 4 years ago by warmerdam

Gao,

I tried running gdaladdo -clean, followed by gdaladdo to add an overview and this seemed to work ok.

I tried the following:

import gdal

gdal.SetConfigOption( 'USE_RRD', 'YES' )
gdal.SetConfigOption( 'HFA_USE_RRD', 'YES' )

ds = gdal.Open('pyr93_v.jpg',gdal.GA_ReadOnly)

ds.BuildOverviews( overviewlist = [] )

ds.BuildOverviews( overviewlist = [ 9 ] )

ds = None

and it worked. But if I remove the config options, it ended up replacing the .aux file with a TIFF file with the name .aux. Is it possible this is the behavior you saw? What overview related config options are in effect in ArcGIS?

Changed 4 years ago by gaopeng

Frank,

The 'USE_RRD'option is not set. The behavior I am looking for is:

- creating new overviews as .ovr for all except HFA - updating existing overviews using the same format.

Changed 4 years ago by gaopeng

Here are overviews related config options:

CPLSetConfigOption("HFA_USE_RRD", "YES"); CPLSetConfigOption("COMPRESS_OVERVIEW", "LZW");

BuildOverviews? is used to directly update/rebuild overviews without removing the existing one first.

Changed 4 years ago by warmerdam

Gao,

I tried the script:

gdal.SetConfigOption( 'COMPRESS_OVERVIEW', 'LZW' )
gdal.SetConfigOption( 'HFA_USE_RRD', 'YES' )

ds = gdal.Open('pyr93_v.jpg',gdal.GA_ReadOnly)
ds.BuildOverviews( overviewlist = [ 9 ] )

and this worked fine, in the sense that it build an _ss_9_ overview layer in the existing .rrd file. If I first clean the overviews, and then generate overviews without closing the file in between then I end up deleting the .rrd file, and .aux file, and then rebuilding the .aux file, but actually in TIFF format and this does not work afterwards. I will fix this aspect though it is not entirely clear that it directly relates to the problem you are seeing.

Changed 4 years ago by warmerdam

  • status changed from reopened to closed
  • version changed from unspecified to svn-trunk
  • resolution set to fixed

I have made changes in the GDALDefaultOverviews::CleanOverviews?() method to reset the osOvrFilename according to the normal rules. Now a clean and build in sequence results in the .aux and .rrd being deleted and an .ovr built.

The changes are in trunk (r17263) and 1.6-esri branch (r17264).

Note: See TracTickets for help on using tickets.