Opened 14 years ago

Closed 13 years ago

#2915 closed defect (fixed)

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 (1)

pyramids93.zip (610.5 KB ) - added by gaopeng 13 years ago.
A smaller sample dataset

Download all attachments as: .zip

Change History (10)

comment:1 by warmerdam, 14 years ago

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...

comment:2 by warmerdam, 13 years ago

Milestone: 1.7.0
Resolution: fixed
Status: newclosed

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

comment:3 by warmerdam, 13 years ago

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

comment:4 by gaopeng, 13 years ago

Resolution: fixed
Status: closedreopened

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.

by gaopeng, 13 years ago

Attachment: pyramids93.zip added

A smaller sample dataset

comment:5 by warmerdam, 13 years ago

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?

comment:6 by gaopeng, 13 years ago

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.

comment:7 by gaopeng, 13 years ago

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.

comment:8 by warmerdam, 13 years ago

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.

comment:9 by warmerdam, 13 years ago

Resolution: fixed
Status: reopenedclosed
Version: unspecifiedsvn-trunk

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.