[OpenLayers-Users] filtering WFS layers

Lourens Veen veen at science.uva.nl
Thu Oct 18 13:30:15 EDT 2007


On Thursday 18 October 2007 18:13:48 vgvallee wrote:
> Ryan Hofschneider-2 wrote:
> > available, you might get an error from your WFS server because
> > WFS.moveTo() will add a BBOX parameter to the request URL which is
> > supposed to be mutually exclusive with the FILTER parameter. At
> > least this is my experience when using OpenLayers with GeoServer
> > 1.5.3.
>
> I am getting this error as well from MapServer 5.0 but not from the
> previous version 4.10.
>
> The following code in function moveTo() of Layer\WFS.js tacks on the
> shorthand '&BBOX=...' to the url.
>
>             var params = {BBOX: this.encodeBBOX ? tileBounds.toBBOX()
>
>                                                 : tileBounds.toArray(
>                                                 :)};
>
>             url += "&" + OpenLayers.Util.getParameterString(params);
>
> Would the it work if the long form was output if another filter was
> used?

I missed the beginning of this conversation it seems (I only recently 
joined the list), but if I understand what you want correctly then I 
actually have that working. The code is at work (and I'm not atm) but 
I've changed the WFS class to accept a "filter" option to which you can 
add an OGC Filter XML filter specification fragment. If you don't, then 
the code will send the BBOX constraint as before, if you do then it 
will combine the fragment with an XML description of the bounding box 
and send it as a FILTER parameter to the WFS server. Work a charm in 
combination with Geoserver.

I can probably post the patch tomorrow, I just have to check what the 
exact procedure is as I want to avoid any possible doubt about legal 
issues.

Lourens

-- 
          ir. Lourens Veen          University of Amsterdam - IBED
                                    Nieuwe Achtergracht 166
    Scientific Software Engineer    1018 WV Amsterdam, The Netherlands
             EcoGRID-GAN            t: +31 20-5257453  f: +31 20-5257431



More information about the Users mailing list