[mapserver-dev] Re: WFS GetFeature Performance - BBOX vs. Filter

Brad Posthumus posthumusb at AGR.GC.CA
Fri Oct 14 14:49:56 EDT 2011


This might be bug in the MapServer itself, or at least an unfinished
function. In our case, when using a filter the code passes through the
FLTApplyFilterToLayerCommonExpression function in mapogcfiltercommon.c. In
this function are these peculiar lines:

    /*TODO: if there is a bbox in the node, get it and set the map extent*/
    map->query.rect = map->extent;

This tells us the query rectangle (used to select which features will be
queried against) is actually the entire map extent. So all one million
features are being selected from the dataset and looped through to determine
if each one falls within the filter's selection polygon. Hence the
performance hit.

I shoe-horned in a clunky patch locally by extracting the bounding box from
the filter expression and using that to set map->query.rect (probably what
the TODO statement is alluding to), and the time to query out a couple of
features from a million+ features in SDE went from 2+ minutes to 7 seconds.

I could be off the mark in my logic though, so it might be worth raising a
bug so a seasoned MapServer veteran can take a closer look.

EDIT: I should mention my "fix" could break other types of queries, which is
why I included the seasoned veteran remark.

(OK, now I'm *really* on the dev mailing list...)

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WFS-GetFeature-Performance-BBOX-vs-Filter-tp6890106p6893644.html
Sent from the Mapserver - Dev mailing list archive at Nabble.com.


More information about the mapserver-dev mailing list