Skip to content

Commit

Permalink
RMF: Fix FlushCache with NoData block
Browse files Browse the repository at this point in the history
 * Fix compute min-max at FlushCache.
 * Compute min-max only once at dataset closing.
  • Loading branch information
drons committed May 28, 2022
1 parent 9160086 commit 9e2d1f3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frmts/rmf/rmfdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,19 +1052,21 @@ void RMFDataset::FlushCache(bool bAtClosing)
poCompressData->oThreadPool.WaitCompletion();
}

if( !bHeaderDirty )
return;

if( eRMFType == RMFT_MTW )
if( bAtClosing && eRMFType == RMFT_MTW )
{
GDALRasterBand *poBand = GetRasterBand(1);

if( poBand )
{
poBand->ComputeRasterMinMax( FALSE, sHeader.adfElevMinMax );
// ComputeRasterMinMax can setup error in case of dataset full
// from NoData values, but it makes no sense here.
CPLErrorReset();
bHeaderDirty = true;
}
}
if( !bHeaderDirty )
return;
WriteHeader();
}

Expand Down

0 comments on commit 9e2d1f3

Please sign in to comment.