[gdal-dev] GeoTIFFs and GetStatistics
Rory O'Connor
rsoconnor at gmail.com
Thu Jan 3 02:50:17 EST 2008
Hello,
Does the TIFF driver support the SetStatistics function? I work with
~4GB TIFF files and it takes a significant amount of time to call
ComputeStatistics. Everytime I open a file or create one it takes about 10
minutes to calculate the statistics, which would be OK if it was a one time
only thing. The statistics are seemingly not cached in the meta
data or the Xml file even if the file was opened as a PAM dataset. Also it
didn't make a difference if the dataset was opened with read-only or update
permissions.
Here is a snippet of my code:
int bForce = FALSE;
int approxOK = TRUE;
CPLErr err = poBand->GetStatistics (approxOK, bForce, minValue,
maxValue, pMean, pStdDev);
if ( err != CE_None )
{
// Stats not cached, recompute them
// BPS - using ApproxOK does not seem to obey the NoDataValue (mean
shifted toward 0)
// also behaves differently if we just made overviews or already had
them
// But it's soooooo much faster than recalcing full stats on a big
file
poBand->ComputeStatistics (FALSE, minValue, maxValue, pMean,
pStdDev, NULL, NULL);
poBand->SetStatistics (*minValue, *maxValue, *pMean, *pStdDev);
}
BTW, thanks for the great product. Overall it has been a joy to use so far.
Regards,
Rory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080102/575539f9/attachment-0001.html
More information about the gdal-dev
mailing list