[Gdal-dev] Do we need to specifically set band's min, max on writting?

Frank Warmerdam warmerdam at pobox.com
Tue Jun 12 22:41:16 EDT 2007


Joaquim Luis wrote:
> Hi,
> 
> When saving a dataset to a file do we have to specifically say what are 
> datasets min and max?
> And if yes, how do we do that? I searched but didn't find any 
> "GDALSetRasterMinimum"
> I am using GDALRasterIO( hBand, GF_Write, ...) and thought band min, max 
> were being
> set automatically but a gdalinfo -stats shows this (the rest, as far as 
> I can see, is ok)
> ....
> Band 1 Block=1781x1 Type=Float32, ColorInterp=Gray
>  Minimum=-1.#IO, Maximum=-1.#IO, Mean=-1.#IO, StdDev=-1.#IO
>  Metadata:
>    STATISTICS_MINIMUM=-1.#IND
>    STATISTICS_MAXIMUM=-1.#IND
>    STATISTICS_MEAN=-1.#IND
>    STATISTICS_STDDEV=-1.#IND

Joaquim,

You do not need to set raster min/max values yourself.  They are normally
computed on request.  The above likely means you have some pixels - perhaps
unwritten portions - which have invalid floating point values.  This
messes up the min/max calculations for floating point.

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