[gdal-dev] SetSpatialFilter geometry filtering vs bbox filtering

Even Rouault even.rouault at spatialys.com
Thu Jan 29 14:54:48 PST 2026


Mike,

This sentence was written on July 8th 1999, so another 
decade/century/millenium :-)  Joke aside, it might still hold some 
truth.  It is indeed driver dependent. The base implementation, for a 
GDAL build against GEOS, does end up doing full geometry intersection, 
and most popular drivers should either call it or do something similar 
on the server side. One exception I've in mind is the PostGIS driver 
that only does server side bounding box intersection. That could/should 
likely be improved to do full intersection

Even

Le 29/01/2026 à 23:20, Michael Smith via gdal-dev a écrit :
> I was looking at the doxygen docs for SetSpatialFilter and saw a sentence that surprised me:
>
> https://gdal.org/en/stable/doxygen/classOGRLayer.html#ac37397c0deda981082cb32dcd25c85d9
>
> Currently this test is may be inaccurately implemented, but it is guaranteed that all features whose envelope (as returned by https://gdal.org/en/stable/doxygen/classOGRGeometry.html#aa3d42b06ae6f7bbef6d1a2886da8d398) overlaps the envelope of the spatial filter will be returned. This can result in more shapes being returned that should strictly be the case.
>
> Is this the case, is it just filtering based on geometry envelopes and not a strict intersection?
>
>
-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list