Skip to content
Permalink
Browse files

[ogr] Also discard features with empty geometries

when feature request specifies a filter rect

OGR sometimes returns a feature with empty geometry (e.g.
a multipolygon with a polygon child with no rings) even when
OGR_L_SetSpatialFilterRect has been set for the layer.

Refs #17365
  • Loading branch information
nyalldawson committed Oct 31, 2017
1 parent eea155d commit f4d3152eea3ec6fe19ef5ff08bd9625581bcc437
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/providers/ogr/qgsogrfeatureiterator.cpp
@@ -266,7 +266,7 @@ bool QgsOgrFeatureIterator::fetchFeature( QgsFeature &feature )
if ( !readFeature( std::move( fet ), feature ) )
continue;

if ( !mFilterRect.isNull() && !feature.hasGeometry() )
if ( !mFilterRect.isNull() && ( !feature.hasGeometry() || feature.geometry().isEmpty() ) )
continue;

// we have a feature, end this cycle

0 comments on commit f4d3152

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