[OpenLayers-Users] CQL queries with WFS

bartvde at osgis.nl bartvde at osgis.nl
Thu Aug 14 10:23:27 EDT 2008


Can you try something like:

var wfsLayer = new OpenLayers.Layer.WFS( "villages",
  http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&typename=villages&request=getfeature&version=1.0.0&service=wfs&,{
  {
    styleMap: oStyleMap
  }
);
var value = "nomos='Eleia'";
wfsLayer.mergeNewParams({'CQL_FILTER', escape(value)});

Best regards,
Bart

> Bart,
> I tried escaping the quotes around the value of the nomos but
> unfortunately it didn't change the returned results.  I used backslashes
> in front of the single quotes around Eleia.  Is this what you had in mind?
>  It may be that I'm not escaping the right part of the filter.
> Thanks,
> Todd
>            wfsLayer = new OpenLayers.Layer.WFS( "villages",
>                 http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&CQL_FILTER=nomos=\'Eleia\'&typename=villages&request=getfeature&version=1.0.0&service=wfs,{
>                {
>                 styleMap: oStyleMap
>                 }
>             );
>
> ________________________________
>
> From: bartvde at osgis.nl [mailto:bartvde at osgis.nl]
> Sent: Thu 8/14/2008 8:52 AM
> To: Brenningmeyer, Todd
> Cc: Andreas Hocevar; Eric Lemoine; Openlayers Users List
> Subject: Re: [OpenLayers-Users] CQL queries with WFS
>
>
>
> Have you tried escaping the value of your parameter CQL_FILTER?
>
> Best regards,
> Bart
>
>> Thanks Andreas and Eric.  I've tried a few different options with the
>> filter but without success.  I'm using the following filter and have
>> tried
>> this with the map location moved into the params section and a few other
>> times with everything in a single URL request but still no luck.  The
>> request returns all of the villages with none of these filtered out.  If
>> you have any ideas that might help please let me know.  Thanks again for
>> your help.
>> Todd
>>            wfsLayer = new OpenLayers.Layer.WFS( "villages",
>>                 "http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&CQL_FILTER=nomos='Eleia'
>> <http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&CQL_FILTER=nomos='Eleia',{//
>> <http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&CQL_FILTER=nomos='Eleia',{//<Filter>
>> ><PropertyIsEqualTo><PropertyName>nom_nr</PropertyName><Literal>39</Literal></PropertyIsEqualTo></Filter>
>> ",{
>>                service: "WFS",
>>                typename: "villages",
>>                request: "getfeature",
>>                version: "1.0.0"
>>                },
>>                {
>>                 extractAttributes: true
>>                 }
>>             );
>>
>> Attempt with the params moved into the URL:
>>            wfsLayer = new OpenLayers.Layer.WFS( "villages",
>>                 "http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&CQL_FILTER=nomos='Eleia'&typename=villages&request=getfeature&version=1.0.0&service=wfs",{
>>                 styleMap: oStyleMap
>>                 }
>>             );
>>
>> ________________________________
>>
>> From: Andreas Hocevar [mailto:andreas.hocevar at gmail.com]
>> Sent: Wed 8/13/2008 7:11 AM
>> To: Eric Lemoine
>> Cc: Brenningmeyer, Todd; Openlayers Users List
>> Subject: Re: [OpenLayers-Users] CQL queries with WFS
>>
>>
>>
>> Hi,
>>
>> On Wed, Aug 13, 2008 at 2:08 PM, Eric Lemoine <eric.c2c at gmail.com>
>> wrote:
>>> On Wed, Aug 13, 2008 at 11:49 AM, Andreas Hocevar
>>> <andreas.hocevar at gmail.com> wrote:
>>>> 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);
>>>
>>> Todd's question related to WFS, but I guess the response is similar,
>>> isn't it?
>>
>> Should be, yes. Just s/WMS/WFS/gi.
>>
>> Regards,
>> Andreas.
>>
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com <http://www.avg.com/>
>> <http://www.avg.com/>
>> Version: 8.0.138 / Virus Database: 270.6.2/1609 - Release Date:
>> 8/13/2008
>> 6:43 AM
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>
>
>
>
>





More information about the Users mailing list