Skip to content

Commit 7c9b2c1

Browse files
committedJul 19, 2012
Allow overwriting of existing raster datasets
1 parent 8ba3a59 commit 7c9b2c1

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed
 

‎src/gui/qgsrasterlayersaveasdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void QgsRasterLayerSaveAsDialog::on_mBrowseButton_clicked()
6969
}
7070
else
7171
{
72-
fileName = QFileDialog::getOpenFileName( this, tr( "Select output file" ) );
72+
fileName = QFileDialog::getSaveFileName( this, tr( "Select output file" ) );
7373
}
7474

7575
if ( !fileName.isEmpty() )

‎src/providers/gdal/qgsgdalprovider.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,11 +2055,6 @@ void QgsGdalProvider::initBaseDataset()
20552055
bool QgsGdalProvider::create( const QString& format, int nBands, QgsRasterDataProvider::DataType type, int width, int height,
20562056
double* geoTransform, const QgsCoordinateReferenceSystem& crs )
20572057
{
2058-
if ( isValid() ) //datasource already exists
2059-
{
2060-
return false;
2061-
}
2062-
20632058
//get driver
20642059
GDALDriverH driver = GDALGetDriverByName( format.toLocal8Bit().data() );
20652060
if ( !driver )
@@ -2091,12 +2086,12 @@ bool QgsGdalProvider::create( const QString& format, int nBands, QgsRasterDataPr
20912086

20922087
bool QgsGdalProvider::write( void* data, int band, int width, int height, int xOffset, int yOffset )
20932088
{
2094-
GDALRasterBandH rasterBand = GDALGetRasterBand( mGdalDataset, band );
2095-
if ( rasterBand == NULL )
2096-
{
2097-
return false;
2098-
}
2099-
return ( GDALRasterIO( rasterBand, GF_Write, xOffset, yOffset, width, height, data, width, height, GDALGetRasterDataType( rasterBand ), 0, 0 ) == CE_None );
2089+
GDALRasterBandH rasterBand = GDALGetRasterBand( mGdalDataset, band );
2090+
if ( rasterBand == NULL )
2091+
{
2092+
return false;
2093+
}
2094+
return ( GDALRasterIO( rasterBand, GF_Write, xOffset, yOffset, width, height, data, width, height, GDALGetRasterDataType( rasterBand ), 0, 0 ) == CE_None );
21002095
}
21012096

21022097
QStringList QgsGdalProvider::createFormats() const

0 commit comments

Comments
 (0)
Please sign in to comment.