CQL queries with WFS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CQL queries with WFS

Per Engström
Hi!

I've been looking at an old conversation (Aug 2008) with the same subject as this where 'Todd Brenningmeyer' tried to use a cql-filter / filter on a OpenLayers.Layer.WFS with no luck.

var wfsLayer = new OpenLayers.Layer.WFS("My layer",
    http://localhost:8080/geoserver/wfs,
    {
        styleMap: myStyle
    }
);
wfsLayer.mergeNewParams({'CQL_FILTER': 'id=1'});

He found out that OpenLayers added a BBOX at the end of the request.

I dug a little bit further and found out that this ALWAYS is added in the moveTo function of OpenLayers.Layer.WFS. When a filter or cql filter is used in the same request as a bbox to a GeoServer you get the following response:
<?xml version="1.0" ?>
<ServiceExceptionReport
version="1.2.0"
xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
<ServiceException>filter and bbox both specified but are mutually exclusive</ServiceException>
</ServiceExceptionReport>
What would be the correct way to exclude the bbox parameter from the request? I would really not like to use Todd's workaround and use a GML layer!

Regards,
Per Engström

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: CQL queries with WFS

Christopher Schmidt-2
On Wed, Jul 01, 2009 at 04:57:15PM +0200, Per Engström wrote:

> Hi!
>
> I've been looking at an old conversation (Aug 2008) with the same subject as
> this where 'Todd Brenningmeyer' tried to use a cql-filter / filter on a
> OpenLayers.Layer.WFS with no luck.
>
> var wfsLayer = new OpenLayers.Layer.WFS("My layer",
>     http://localhost:8080/geoserver/wfs,
>     {
>         styleMap: myStyle
>     }
> );
> wfsLayer.mergeNewParams({'CQL_FILTER': 'id=1'});
>
> He found out that OpenLayers added a BBOX at the end of the request.
>
> I dug a little bit further and found out that this ALWAYS is added in the
> moveTo function of OpenLayers.Layer.WFS. When a filter or cql filter is used
> in the same request as a bbox to a GeoServer you get the following response:
>
> <?xml version="1.0" ?>
> <ServiceExceptionReport
>    version="1.2.0"
>    xmlns="http://www.opengis.net/ogc"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://www.opengis.net/ogc
> http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
>    <ServiceException>filter and bbox both specified but are mutually
> exclusive</ServiceException>
> </ServiceExceptionReport>
>
> What would be the correct way to exclude the bbox parameter from the
> request? I would really not like to use Todd's workaround and use a GML
> layer!

1. Dont' use Layer.WFS. Instead, use a Layer.Vector with a WFS protocol.
2. Use OpenLayers 2.8, which looks for layer.params.filter and doesn't
   add a bbox if it's there, but this is just a hack, and not the
   recommended way to use WFS.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: CQL queries with WFS

TrevorQuinn
In reply to this post by Per Engström
Does this post help?

http://www.mail-archive.com/users@openlayers.org/msg09580.html

I'm dealing with the same issue.
Reply | Threaded
Open this post in threaded view
|

Re: CQL queries with WFS

Steffen G
yes, the link is very useful.