[Gdal-dev] Reading from Overviews with GDALDataset

Frank Warmerdam warmerdam at pobox.com
Thu Nov 30 19:40:13 EST 2006

David Friberg wrote:
> So it sounds like you are saying that if I read using
> GDALDataset::RasterIO, passing the same number for both PixelSpace and
> LineSpace, an attempt will be made to use an overview sampled at the
> requested rate to fullfill that read request.  Correct?


Your basic idea is right, but what overview is used is determined based
on the ratio of the nXSize * nYSize region on file relative to the
nBufXSize * nBufYSize buffer size.  The pixel and line spacing values
are just to control how data is organized in the buffer.

> For my purposes, I want to read portions of external image files at
> some resolution only if those files actually contain image data at
> that resolution; I do not want GDAL to do any sampling.  So I suppose
> I will also need to query one of the GDALRasterBands comprising the
> dataset in order to get the number of overviews (presumably could use
> the first band in the dataset?).

You would likely be best grabbing the overview GDALRasterBand objects
and reading at full resolution from them if you want to be sure that
no sampling takes place.

Note that for some file formats there may actually be different
overviews built on different bands though this is quite uncommon.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list