[Gdal-dev] Scaling of heights in gdaladdo

Frank Warmerdam warmerdam at pobox.com
Fri Mar 19 01:36:14 EST 2004


Robert Osfield wrote:
> Hi All,
> 
> I have been testing out my 3D database generation codes on some sample 
> datasets and have found a few issues with generation of/and using overviews.  
> The problem can be seen when looking at the min max values before and after 
> running gdaladdo.  For the test below the min/max values start of as 0 and 
> 43929.00 and end up being 0 and 18039 respectively.  I would expect a certain 
> amount rounding, but not reduction by 2.4 times.

Robert,

I have reproduced your problem.  The reason is that the "-mm" switch for
gdalinfo invokes GDALComputeRasterMinMax() and passes the "bApproxOK" flag
in as TRUE.  When bApproxOK is true, only a subset of file blocks are read
to compute the min and max.

As it happens, GDAL normally creates overviews as tile files (128x128 tiles)
and it just so happens that the set of blocks uses for computing the min/max
happens to not include any of the few extreme peaks in your data that
go above 18039.

Since "-mm" is not the default reporting option in gdalinfo, I have changed
it to force an exact computation of the min/max. But beware.  Some applications
may use GDALComputeRasterMinMax() with bApproxOK=TRUE to get scaling values.
This can result in significant errors as is the case with your dataset.

PS. you can generate overviews for .png files, but they are stored in an
external .ovr file (which is really a GeoTIFF file).

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    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list