Skip to content

Commit

Permalink
Respect OVERWRITE parameter in package layers algorithm
Browse files Browse the repository at this point in the history
Fix #33721
  • Loading branch information
m-kuhn committed Jan 10, 2020
1 parent 5ef1607 commit 0c51d2f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/analysis/processing/qgsalgorithmpackage.cpp
Expand Up @@ -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() ) ) );

Expand Down

0 comments on commit 0c51d2f

Please sign in to comment.