[Gdal-dev] BuildOverviews

Ma Jun junm at comsine.co.uk
Tue Aug 10 11:05:39 EDT 2004

Dear all,

I met some problems when using the Dataset's Method: BuildOverviews.

My aim is to use it for making small image of the original one.

1. Development environment is listed below,
Language: Python
IDE: PythonWin
Operation System: WindowsXP

2. Source code:

import gdal
import gdal.gdalnumeric
from math import *
from gdal.gdalconst import *
from gdal.ogr import *
from gdal.osr import *
import numarray
import numarray.nd_image

src_dem = gdal.Open(“test.tif”) # open the tif file
result = rc_dem.BuildOverviews(resampling="NEAREST" ,overviewlist
=[10] ,callback = callback) # build the overviews
if (result == gdal.CE_Failure):
 print "failed to build overviews"

# callback function
def callback(complete, msg, data):
 print complete, msg, data

It doesn’t work. The result is gdal.CE_Failure. The message returned
by callback function is “0.0 None”.

The test data is a Landsat TIF file. I can open the file and read all
the bands, so the file should be okay. I’ve tried some other tif
files and varied the parameters: "NEAREST", "AVERAGE", "MODE" and
[2,4,8], [2,4,8,16,32,64]. I got the same result and callback message.

Did any one meet this problem before? Could you please give me some

Thanks a lot.

Kind regards,


More information about the Gdal-dev mailing list