Skip to content

Commit bbb5990

Browse files
committed
[oracle] Always check bounding box intersection when using filter rect
Because oracle sdo_filter sometimes returns results outside the given filter (depending on the spatial index), and is only designed for use as a fast "first-pass" filter. From the Oracle docs: "This operator performs only a primary filter operation.. The secondary filtering operation, performed by the SDO_RELATE operator, can be used to determine with certainty if objects interact spatially." Instead of using SDO_RELATE we can instead just do a bounding box intersection inside QGIS if an exact intersection is not required. Fixes failing provider conformance test suite for oracle provider. (cherry-picked from f9a8d9f)
1 parent 3921bf5 commit bbb5990

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/providers/oracle/qgsoraclefeatureiterator.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,16 +301,16 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
301301

302302
if (( mRequest.flags() & QgsFeatureRequest::ExactIntersect ) == 0 )
303303
{
304-
// couldn't use sdo_filter earlier
305-
if ( !mSource->mHasSpatialIndex )
304+
// even if we could use sdo_filter earlier, we still need to double-check the results
305+
// as sdo_filter can return results outside the filter (it's only a first-pass
306+
// filtering operation!)
307+
308+
// only want features which intersect with bbox
309+
if ( !feature.geometry()->boundingBox().intersects( mRequest.filterRect() ) )
306310
{
307-
// only intersect with bbox
308-
if ( !feature.geometry()->boundingBox().intersects( mRequest.filterRect() ) )
309-
{
310-
// skip feature that don't intersect with our rectangle
311-
QgsDebugMsg( "no bbox intersect" );
312-
continue;
313-
}
311+
// skip feature that don't intersect with our rectangle
312+
QgsDebugMsg( "no bbox intersect" );
313+
continue;
314314
}
315315
}
316316
else if ( !mConnection->hasSpatial() || !mSource->mHasSpatialIndex )

0 commit comments

Comments
 (0)