Skip to content

Commit

Permalink
Fix merge lines in dissolve
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 22, 2019
1 parent bb78d1c commit 5e66cd2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/analysis/processing/qgsalgorithmdissolve.cpp
Expand Up @@ -215,6 +215,8 @@ QVariantMap QgsDissolveAlgorithm::processAlgorithm( const QVariantMap &parameter
return processCollection( parameters, context, feedback, [ & ]( const QVector< QgsGeometry > &parts )->QgsGeometry
{
QgsGeometry result( QgsGeometry::unaryUnion( parts ) );
if ( QgsWkbTypes::geometryType( result.wkbType() ) == QgsWkbTypes::LineGeometry )
result = result.mergeLines();
// 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 )
Expand All @@ -227,7 +229,7 @@ QVariantMap QgsDissolveAlgorithm::processAlgorithm( const QVariantMap &parameter
for ( const auto &p : parts )
{
result = QgsGeometry::unaryUnion( QVector< QgsGeometry >() << result << p );
if ( QgsWkbTypes::flatType( result.wkbType() ) == QgsWkbTypes::LineString )
if ( QgsWkbTypes::geometryType( result.wkbType() ) == QgsWkbTypes::LineGeometry )
result = result.mergeLines();
if ( feedback->isCanceled() )
return result;
Expand Down

0 comments on commit 5e66cd2

Please sign in to comment.