Skip to content
Permalink
Browse files

[procesing] Fix dissolve issue by taking the slower route in case of …

…GEOS exception
  • Loading branch information
elpaso committed Nov 23, 2018
1 parent 235c44e commit 947f82d89020fb960ff739a78b73ff52151e886a
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/analysis/processing/qgsalgorithmdissolve.cpp
@@ -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 );

0 comments on commit 947f82d

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