mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Merge pull request #8230 from m-kuhn/gdalDoNotPersistEstimatedMetadata
Do not persist estimated GDAL metadata
This commit is contained in:
commit
8f4f7f11ac
@ -470,7 +470,15 @@ QgsGdalProvider::~QgsGdalProvider()
|
||||
}
|
||||
if ( mGdalDataset )
|
||||
{
|
||||
// Check if already a PAM (persistent auxiliary metadata) file exists
|
||||
QString pamFile = dataSourceUri( true ) + QLatin1String( ".aux.xml" );
|
||||
bool pamFileAlreadyExists = QFileInfo( pamFile ).exists();
|
||||
|
||||
GDALClose( mGdalDataset );
|
||||
|
||||
// If GDAL created a PAM file right now by using estimated metadata, delete it right away
|
||||
if ( !mStatisticsAreReliable && !pamFileAlreadyExists && QFileInfo( pamFile ).exists() )
|
||||
QFile( pamFile ).remove();
|
||||
}
|
||||
|
||||
if ( mpParent && *mpParent == this )
|
||||
@ -2468,6 +2476,7 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int bandNo, int stats, const
|
||||
myerval = GDALComputeRasterStatistics( myGdalBand, bApproxOK,
|
||||
&pdfMin, &pdfMax, &pdfMean, &pdfStdDev,
|
||||
progressCallback, &myProg );
|
||||
mStatisticsAreReliable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -296,6 +296,8 @@ class QgsGdalProvider : public QgsRasterDataProvider, QgsGdalProviderBase
|
||||
* Converts a world (\a x, \a y) coordinate to a pixel \a row and \a col.
|
||||
*/
|
||||
bool worldToPixel( double x, double y, int &col, int &row ) const;
|
||||
|
||||
bool mStatisticsAreReliable = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user