Bug report #8584

WFS 1.0.0 Client requests with FILTER fails against Geoserver

Added by Bernd Deckert about 11 years ago. Updated over 10 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Web Services clients/WFS
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17326

Description

The supposed bug concerns 1.0.0 WFS Client of QGIS 2.0 : WFS requests with filters fails against Geoserver (tested versions : 2.1.3 and 2.3.0).
It formerly worked in QGIS 1.8

Through the GUI the QGIS 1.8 generates this kind of WFS request
http://localhost:8080/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=wxf4gf:communes&SRSNAME=EPSG:2154&FILTER=
<Filter>
<PropertyIsEqualTo>
<PropertyName>code_dept</PropertyName>
<Literal>30</Literal>
</PropertyIsEqualTo>
</Filter>

This query works fine.

For the same request the QGIS 2.0 version adds "ogc" namespace for the filter
http://localhost:8080/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=wxf4gf:communes&SRSNAME=EPSG:2154&FILTER=
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>code_dept</ogc:PropertyName>
<ogc:Literal>30</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

This query doesn't work

To work with Geoserver we need de declare the ogc namespace (xmlns:ogc="http://www.opengis.net/ogc") in the filter this way :
http://localhost:8080/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=wxf4gf:communes&SRSNAME=EPSG:2154&FILTER=
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>code_dept</ogc:PropertyName>
<ogc:Literal>30</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

With my basic programming skills I've tried to take a look to the source code.
The following file could be affected :
https://issues.qgis.org/projects/quantum-gis/repository/revisions/master/entry/src/core/qgsogcutils.cpp

On line 16 there is a "GML_NAMESPACE" (GML_NAMESPACE = "http://www.opengis.net/gml") constant declaration.
This contant is used many times by the "elementsByTagNameNS" method.

On line 1860 we have : QDomElement filterElem = doc.createElement( "ogc:Filter" );
Perhaps we have just to apply a kind of "OGC_NAMESPACE" (OGC_NAMESPACE = "http://www.opengis.net/ogc") here ?

Hope I was clear enough and not too long. Many thanks.

Associated revisions

Revision 10c15089
Added by Martin Dobias over 10 years ago

Fix #8584 (WFS requests with FILTER fails against Geoserver)

History

#1 Updated by Bernd Deckert about 11 years ago

  • Target version set to Version 2.0.0

#2 Updated by Giovanni Manghi about 11 years ago

  • Target version changed from Version 2.0.0 to Future Release - High Priority
  • Priority changed from Normal to Severe/Regression
  • Category set to Web Services clients/WFS

if it is a regression then is a blocker... for the next release (2.1).

#3 Updated by Juergen Weichand about 11 years ago

A QGIS 2.0 WFS 1.0.0 request also fails against other WFS-Server like deegree 3.
(because of the missing ogc namespace declaration)

#4 Updated by Martin Dobias over 10 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF