Skip to content

Commit 57e5b9f

Browse files
committedApr 25, 2018
difference: skip empty geometries, convert to multi-part geometries
1 parent d2513e0 commit 57e5b9f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎src/analysis/processing/qgsoverlayutils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ void QgsOverlayUtils::difference( const QgsFeatureSource &sourceA, const QgsFeat
8383
geom = geom.difference( geomB );
8484
}
8585

86+
// if geomB covers the whole source geometry, we get an empty geometry collection
87+
if ( geom.isEmpty() )
88+
continue;
89+
8690
const QgsAttributes attrsA( featA.attributes() );
8791
switch ( outputAttrs )
8892
{
@@ -100,6 +104,7 @@ void QgsOverlayUtils::difference( const QgsFeatureSource &sourceA, const QgsFeat
100104
}
101105

102106
QgsFeature outFeat;
107+
geom.convertToMultiType();
103108
outFeat.setGeometry( geom );
104109
outFeat.setAttributes( attrs );
105110
sink.addFeature( outFeat, QgsFeatureSink::FastInsert );

0 commit comments

Comments
 (0)
Please sign in to comment.