[gdal-dev] Force bounding box test for spatial filter in OGR

Martin Dobias wonder.sk at gmail.com
Fri May 11 16:08:16 EDT 2012


Hi all,

when fetching features in OGR with an active spatial filter, first a
bounding box test is used to resolve simple cases and then exact
intersection with GEOS is done to determine whether the feature is
really within the filter (if compiled with GEOS). I would like to have
an option to force only bounding box test without the expensive GEOS
intersection.

Motivation: recently I have encountered a shapefile with contour
lines: 72K features, geometries with lots of vertices. When displaying
about 1/2 of the layer's extent in QGIS, it takes ~106 seconds to get
the map rendered! When I temporarily disabled setting of spatial
filter in OGR provider, the rendering time went down to ~5 seconds.
That's a great difference, isn't it? I know that this is not the most
typical case, but still it matters. (For the record, spatial index
made little to no difference to original time since the contour lines
are spread out). In general when rendering one does not care so much
if also features slightly outside of the current extent get fetched -
they will be clipped by the rendering engine and that is definitely
faster than the intersection algorithm.

Do you have any suggestions how such option should be implemented -
e.g. add OGRLayer::setFlags(...) method? Would be such addition
accepted?

Regards
Martin


More information about the gdal-dev mailing list