Skip to content
Permalink
Browse files

Respect OVERWRITE parameter in package layers algorithm

Fix #33721
  • Loading branch information
m-kuhn authored and nyalldawson committed Jan 10, 2020
1 parent 0bb554c commit b12edae584b0cf40485ab399c00eb4e05082042d
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/analysis/processing/qgsalgorithmpackage.cpp
@@ -106,7 +106,13 @@ QVariantMap QgsPackageAlgorithm::processAlgorithm( const QVariantMap &parameters
throw QgsProcessingException( QObject::tr( "GeoPackage driver not found." ) );
}

gdal::ogr_datasource_unique_ptr hDS( OGR_Dr_CreateDataSource( hGpkgDriver, packagePath.toUtf8().constData(), nullptr ) );
gdal::ogr_datasource_unique_ptr hDS;

if ( !QFile::exists( packagePath ) )
hDS = gdal::ogr_datasource_unique_ptr( OGR_Dr_CreateDataSource( hGpkgDriver, packagePath.toUtf8().constData(), nullptr ) );
else
hDS = gdal::ogr_datasource_unique_ptr( OGROpen( packagePath.toUtf8().constData(), true, nullptr ) );

if ( !hDS )
throw QgsProcessingException( QObject::tr( "Creation of database failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );

0 comments on commit b12edae

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