Skip to content

Commit

Permalink
difference: skip empty geometries, convert to multi-part geometries
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Apr 25, 2018
1 parent d2513e0 commit 57e5b9f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/analysis/processing/qgsoverlayutils.cpp
Expand Up @@ -83,6 +83,10 @@ void QgsOverlayUtils::difference( const QgsFeatureSource &sourceA, const QgsFeat
geom = geom.difference( geomB );
}

// if geomB covers the whole source geometry, we get an empty geometry collection
if ( geom.isEmpty() )
continue;

const QgsAttributes attrsA( featA.attributes() );
switch ( outputAttrs )
{
Expand All @@ -100,6 +104,7 @@ void QgsOverlayUtils::difference( const QgsFeatureSource &sourceA, const QgsFeat
}

QgsFeature outFeat;
geom.convertToMultiType();
outFeat.setGeometry( geom );
outFeat.setAttributes( attrs );
sink.addFeature( outFeat, QgsFeatureSink::FastInsert );
Expand Down

0 comments on commit 57e5b9f

Please sign in to comment.