[OpenLayers-Users] CQL queries with WFS

Andreas Hocevar andreas.hocevar at gmail.com
Wed Aug 13 05:49:08 EDT 2008


Hi,

Since CQL_FILTER is not part to the WMS spec, the best way is to add
the filter to the WMS url, e.g.

var layer=new OpenLayers.Layer.WMS("cql",
"http://your-server/wms?CQL_FILTER=foo<3", params, options);

Regards,
Andreas.

On Tue, Aug 12, 2008 at 9:14 PM, Brenningmeyer, Todd
<tbrenningmeyer at maryville.edu> wrote:
> I've also tried this with a URL style request within Openlayers and while I got different results (nothing was selected or displayed from that layer) it still was not what I expected.  The second filter I used was:
> filter: '<Filter><PropertyIsEqualTo><PropertyName>nom_nr</PropertyName><Literal>39</Literal></PropertyIsEqualTo></Filter>'
> This filter uses a different field in the database but it should select more or less the same features.  I replaced the CQL filter I listed before with this but without success.  Both this filter and the CQL filter return correct results when I paste them in the URL.  It's just the openlayers syntax that is giving me headaches.  Based on what I've seen on the list-serve postings this should work.  If anyone has suggestions I'm all ears.
> Thanks,
> Todd
>
>
> ________________________________
>
> From: users-bounces at openlayers.org on behalf of Brenningmeyer, Todd
> Sent: Tue 8/12/2008 12:55 PM
> To: Openlayers Users List
> Subject: [OpenLayers-Users] CQL queries with WFS
>
>
>
> Has anyone used CQL queries with mapserver WFS within Openlayers?  I'm using the request at the bottom of this email but all of the features are returned (with none filtered out).  The URL request works fine but I can't seem to get this to return properly in openlayers.
>
>  Working URL:  http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&request=getfeature&version=1.0.0&service=wfs&propertyname=nomos&typename=villages&CQL_FILTER=nomos=Eleia <http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&request=getfeature&version=1.0.0&service=wfs&propertyname=nomos&typename=villages&CQL_FILTER=nomos=Eleia>
>
> Openlayers request:
>
>           wfsLayer = new OpenLayers.Layer.WFS( "villages",
>               "http://localhost/cgi-bin/mapserv.exe",{
>               typename: "villages",
>               map: "../htdocs/amap/sites_wfs.map",
>               propertyname: 'nom_nr',
>               CQL_FILTER: 'nom_nr=39'},
>               {
>                extractAttributes: true,
>                styleMap: oStyleMap,
>                }
>            );
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list