Skip to content
Permalink
Browse files

Allow overwriting of existing raster datasets

  • Loading branch information
mhugent committed Jul 19, 2012
1 parent 8ba3a59 commit 7c9b2c10dfbdd2cc35c1ae375c9e4f482ecfc36c
Showing with 7 additions and 12 deletions.
  1. +1 −1 src/gui/qgsrasterlayersaveasdialog.cpp
  2. +6 −11 src/providers/gdal/qgsgdalprovider.cpp
@@ -69,7 +69,7 @@ void QgsRasterLayerSaveAsDialog::on_mBrowseButton_clicked()
}
else
{
fileName = QFileDialog::getOpenFileName( this, tr( "Select output file" ) );
fileName = QFileDialog::getSaveFileName( this, tr( "Select output file" ) );
}

if ( !fileName.isEmpty() )
@@ -2055,11 +2055,6 @@ void QgsGdalProvider::initBaseDataset()
bool QgsGdalProvider::create( const QString& format, int nBands, QgsRasterDataProvider::DataType type, int width, int height,
double* geoTransform, const QgsCoordinateReferenceSystem& crs )
{
if ( isValid() ) //datasource already exists
{
return false;
}

//get driver
GDALDriverH driver = GDALGetDriverByName( format.toLocal8Bit().data() );
if ( !driver )
@@ -2091,12 +2086,12 @@ bool QgsGdalProvider::create( const QString& format, int nBands, QgsRasterDataPr

bool QgsGdalProvider::write( void* data, int band, int width, int height, int xOffset, int yOffset )
{
GDALRasterBandH rasterBand = GDALGetRasterBand( mGdalDataset, band );
if ( rasterBand == NULL )
{
return false;
}
return ( GDALRasterIO( rasterBand, GF_Write, xOffset, yOffset, width, height, data, width, height, GDALGetRasterDataType( rasterBand ), 0, 0 ) == CE_None );
GDALRasterBandH rasterBand = GDALGetRasterBand( mGdalDataset, band );
if ( rasterBand == NULL )
{
return false;
}
return ( GDALRasterIO( rasterBand, GF_Write, xOffset, yOffset, width, height, data, width, height, GDALGetRasterDataType( rasterBand ), 0, 0 ) == CE_None );
}

QStringList QgsGdalProvider::createFormats() const

0 comments on commit 7c9b2c1

Please sign in to comment.
You can’t perform that action at this time.