Skip to content

Commit

Permalink
[procesing] Fix dissolve issue by taking the slower route in case of …
Browse files Browse the repository at this point in the history
…GEOS exception
  • Loading branch information
elpaso committed Nov 23, 2018
1 parent 235c44e commit 947f82d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/analysis/processing/qgsalgorithmdissolve.cpp
Expand Up @@ -215,6 +215,17 @@ QVariantMap QgsDissolveAlgorithm::processAlgorithm( const QVariantMap &parameter
return processCollection( parameters, context, feedback, [ & ]( const QVector< QgsGeometry > &parts )->QgsGeometry
{
QgsGeometry result( QgsGeometry::unaryUnion( parts ) );
// Geos may fail in some cases, let's try a slower but safer approach
// See: https://issues.qgis.org/issues/20591 - Dissolve tool failing to produce outputs
if ( ! result.lastError().isEmpty() && parts.count() > 2 )
{
QgsDebugMsg( QStringLiteral( "GEOS exception, taking the slower route ..." ) );
result = QgsGeometry();
for ( const auto &p : parts )
{
result = QgsGeometry::unaryUnion( QVector< QgsGeometry >() << result << p );
}
}
if ( ! result.lastError().isEmpty() )
{
feedback->reportError( result.lastError(), true );
Expand Down

0 comments on commit 947f82d

Please sign in to comment.