Andrea
Thank you for your comments.
That does not seem to be the problem,though. Everything works as expected
using WMS: "Desc LIKE '%bird%'" shows only features containing birds, "desc
LIKE '%bird%'" shows no features ("desc" is an invalid attribute name), and
"Desc x '%bird%'" shows tiles with an error message.
Under WFS I always get all features returned, even with invalid attribute
names, except when the CQL is syntactically wrong ("Desc x '%bird%'") when
nothing is returned. Maybe Openlayers only caters for ogc filters using
OpenLayers.Protocol.WFS?
Tony
-----Original Message-----
From: Andrea Aime [mailto:[email protected]]
Sent: Monday, 27 September 2010 12:27 a.m.
To: [email protected]
Subject: Re: [Geoserver-users] CQL filter with WFS
On 25/09/2010 11:50, Tony Stewart wrote:
> I'm having problems with a CQL filter on a WFS layer, using
> Openlayers and Geoserver 2.0.2.
>
> The following layer definition returns all features, not just those
> where*Desc* contains*bird*.
>
> var photopoints = new OpenLayers.Layer.Vector("Photos", {
>
> strategies: [new OpenLayers.Strategy.Fixed()],
>
> projection: new OpenLayers.Projection("EPSG:2193"),
>
> protocol: new OpenLayers.Protocol.WFS({
>
> version: "1.1.0",
>
> srsName: "EPSG:2193",
>
> url: "../wfs",
>
> params: {CQL_FILTER: "Desc LIKE '%bird%'"},
>
> featureNS : "http://www.orokonui.org.nz/orok",
>
> featureType: 'photopoints',
>
> featurePrefix: 'Orokonui',
>
> geometryName: "the_geom"
>
> }),
>
> displayInLayerSwitcher: true,
>
> styleMap: smap
>
> });
>
> However, if I enter a nonsense filter, for example {CQL_FILTER:"Desc
> x '%bird%'"}, nothing is returned and Firebug shows that Geoserver
> has responded with ....<ows:Exception
> exceptionCode="NoApplicableCode"> <ows:ExceptionText>Could not parse
> CQL filter list.....
The most common cause for this kind of error is a typo in the
attribute name (including using the wrong case for letters):
evaluating a property that's not there results in null, not
in an error.
null like '%bird%' -> false
Cheers
Andrea
----------------------------------------------------------------------------
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users