Skip to content
Permalink
Browse files

Fix merge lines in dissolve

  • Loading branch information
m-kuhn committed Feb 22, 2019
1 parent bb78d1c commit 5e66cd2fda5389fecad88ecfcb05a3fb1ab97827
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/analysis/processing/qgsalgorithmdissolve.cpp
@@ -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 )
@@ -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;

0 comments on commit 5e66cd2

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