Skip to content

Commit

Permalink
[raster] Remove preexisting pyramid files when over-writing a raster (#…
Browse files Browse the repository at this point in the history
…7677)

(failing to do so can lead to new raster relying on old pyramid
files, corrupting the rendering)
  • Loading branch information
nirvn committed Aug 25, 2018
1 parent 4bea2ef commit 0782c12
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/raster/qgsrasterfilewriter.cpp
Expand Up @@ -130,6 +130,14 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeRaster( const QgsRast
}
}

// Remove pre-existing overview files to avoid using those with new raster
QFile pyramidFile( mOutputUrl + ( mTiledMode ? ".vrt.ovr" : ".ovr" ) );
if ( pyramidFile.exists() )
pyramidFile.remove();
pyramidFile.setFileName( mOutputUrl + ( mTiledMode ? ".vrt.rrd" : ".rrd" ) );
if ( pyramidFile.exists() )
pyramidFile.remove();

if ( mMode == Image )
{
WriterError e = writeImageRaster( &iter, nCols, nRows, outputExtent, crs, feedback );
Expand Down

0 comments on commit 0782c12

Please sign in to comment.