Opened 8 years ago

Closed 8 years ago

#6326 closed defect (wontfix)

gdalwarp -ovr default option should be NONE instead of AUTO

Reported by: cgmorton Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 2.0.0
Severity: normal Keywords: gdalwarp
Cc:

Description

When running gdalwarp, the default -ovr parameter is AUTO, which "will select the overview level whose resolution is the closest to the target resoultion". If the gdalwarp resampling method is different than the source raster overviews resampling method, the resulting output raster can be quite a bit different than if the source raster didn't have overviews or if the -ovr parameter was set to NONE.

I came across this when trying to resample a raster using the "average" option when the pyramids had been built using "nearest" (the gdaladdo default). It seems like if a user is setting a resampling method, they probably want to use that method and not the method that was used to generate the overviews, or they should explicitly set the -ovr parameter instead.

The following is a simple test case that will hopefully show the problem. First, the input raster is resampled from 100m to 2000m with no overviews. Then, overviews are built and the raster is resampled but the -ovr parameter is set to NONE. Finally, the raster is resampled with the default -ovr AUTO setting, and the resulting output (low_res_pyramids.img) is quite a bit different than the other two.

gdaladdo -clean full_res.img
gdalwarp -r average -of HFA -tr 2000 2000 -overwrite full_res.img low_res_no_pyramids.img

gdaladdo -r nearest --config HFA_USE_RRD YES full_res.img 2 4 8 16
gdalwarp -r average -of HFA -tr 2000 2000 -overwrite -ovr NONE full_res.img low_res_ovr_none.img
gdalwarp -r average -of HFA -tr 2000 2000 -overwrite full_res.img low_res_pyramids.img

Attachments (1)

full_res.img (26.0 KB ) - added by cgmorton 8 years ago.

Download all attachments as: .zip

Change History (4)

by cgmorton, 8 years ago

Attachment: full_res.img added

comment:1 by cgmorton, 8 years ago

Version: unspecified1.11.3

comment:2 by Even Rouault, 8 years ago

Version: 1.11.32.0.0

Thanks for the detailed analysis, but I believe the default of AUTO -ovr is the one that will generally be the most useful for people (the assumption is that the overviews are generated with sufficient quality). People have long complained that overviews weren't used for warping, causing performance issues. We might revisit that in case we get a lot of complaints about the new default (but we won't hear from people happy with it, so...).

Ideally if we could know with which resampling method the overviews had been generated, we could improve the heuristics or emit a warning message, but this isn't available.

I've documented your findings in r33101 "gdalwarp doc: add hint that -ovr NONE can be useful if overviews have been generated with a low quality resampling method, and the warping is done using a higher quality resampling (#6326)"

comment:3 by Even Rouault, 8 years ago

Resolution: wontfix
Status: newclosed

Closing. There's a way to change the default behaviour if it doesn't give the expected results.

Note: See TracTickets for help on using tickets.