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

Yewondwossen ASSEFA yassefa at dmsolutions.ca
Mon Oct 17 08:56:49 EDT 2011


Hi Brad,

  Couple of notes on this.
  The ogc filter sent with the wfs request is parsed and the result is 
used to set the filter element on the layer object. This was done as 
part of RFC-64 [1]. Once the filter element is set, each driver can then 
interpret and produce driver specific queries. Right now none of the db 
drivers (postgis. oracle, sde ...) do that. It is been on a todo list 
since the RFC was implemented. MapServer 6.2 might include this feature 
for the postgis driver. So, this clean way of solving all issues related 
to ogc fiIter and drivers would be to do the implementation at driver level.
For your particular case, if the filter encoding is "simple" (simple in 
this case means one bbox, (one spatial expression), that limits the 
whole query), you can certainly set the query rectangle to this bbox.  
You can enter a bug and patch on it and assign it to me (assefa) and I 
will comment/review/apply it.

best regards,

Y. Assefa


On 11-10-14 02:49 PM, Brad Posthumus wrote:
> 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.
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>


-- 
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------




More information about the mapserver-dev mailing list