[OpenLayers-Users] Filtering a WFS Layer

Andrew Haigh haighaj+ollist at googlemail.com
Fri Mar 12 05:23:36 EST 2010


I'm attempting to work out how to apply a filter to a WFS layer (from
GeoServer 2.0.1), I've looked at the examples / documentation / forums and
there seems to be a lot of discussion about doing this but I can't seem to
find a definative solution.

I've seen this thread
http://n2.nabble.com/WFS-GetFeature-Filter-td4026139.html which seems to
indicate I need to download the latest build, so I'm using the nightly build
from the OpenLayers site which reports a version number of 'Revision 10086'.

This is my code:

wfsLayer = new OpenLayers.Layer.Vector( "WFS", {
   strategies: [new OpenLayers.Strategy.BBOX()],
   projection: new OpenLayers.Projection("EPSG:27700"),
   maxExtent: new OpenLayers.Bounds(0, 0, 13000000, 13000000),
   styleMap: mstylemap,
   protocol: new OpenLayers.Protocol.WFS({
       url: "/MyApp/Proxy.ashx",
       version: "1.1.0",
       srsName: "EPSG:27700",
       featurePrefix: "ora_store",
       featureType: "BOUNDARY",
       geometryName: "GEOM",
       featureID: "OBJECTID",
       defaultFilter: new
OpenLayers.Filter.FeatureId(["BOUNDARY.1102283472"]) // should this be
1102283472 ?
   })
});

The FireFox error console reports: Error: uncaught exception: Filter writing
not supported for rule type: undefined

If I comment out the filter then the WFS layer works fine.

So it appears that I've done something wrong in configuring my filter but I
can't seem to work out what.

Do I need to set the filter elsewhere?

Also when using the FeatureId filter I assume I should use the ID as
returned in GML (BOUNDARY.1102283472) and not as stored in the database
(1102283472) - is that correct? I've tested both ways and get the same
error.

Thanks in advance

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100312/49b13119/attachment.html


More information about the Users mailing list