Bug report #16369

Filter query on WFS layer doesn't work

Added by Stefan Rey over 7 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Unknown
Affected QGIS version:2.18.4 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:24279

Description

I tried it with QGIS 2.18.4-1 as well as 2.99.0-32 (nightly build), both with the same behaviour. I wanted to add a WFS point layer. The WFS I use is https://geodienste.ch/db/av , I added for example the layer 'Einzelobjekte (Punkte)'. That works fine so far.

Now I want to add a filter on this specific layer. The query I placed in the query builder is "Kanton" = 'BE'. The feature count is now reduzed, but the all the features displayed in the map disappear.

I also tried to make the query adding the WFS layer (see printscreen). The layer is added, but no feature is displayed in the map.

21.03.png (58.5 KB) Stefan Rey, 2017-03-21 02:04 AM

History

#1 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#2 Updated by Jürgen Fischer about 7 years ago

  • Category set to Unknown

#3 Updated by Even Rouault over 6 years ago

  • Resolution set to invalid
  • Description updated (diff)

Ater investigation, this is an issue with the WFS server itself, where spatial + attribute filter fail (I tried all 3 WFS version=

For example

https://wfs.geodienste.ch/av/deu?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=ms:SOPT&STARTINDEX=0&COUNT=1000&SRSNAME=urn:ogc:def:crs:EPSG::2056&FILTER=%3Cfes:Filter xmlns:fes%3D%22http://www.opengis.net/fes/2.0%22 xmlns:gml%3D%22http://www.opengis.net/gml/3.2%22%3E%0A %3Cfes:And%3E%0A %3Cfes:BBOX%3E%0A %3Cfes:ValueReference%3EmsGeometry%3C/fes:ValueReference%3E%0A %3Cgml:Envelope srsName%3D%22urn:ogc:def:crs:EPSG::2056%22%3E%0A %3Cgml:lowerCorner%3E2427790 1059290%3C/gml:lowerCorner%3E%0A %3Cgml:upperCorner%3E2886430 1310890%3C/gml:upperCorner%3E%0A %3C/gml:Envelope%3E%0A %3C/fes:BBOX%3E%0A %3Cfes:PropertyIsEqualTo xmlns:fes%3D%22http://www.opengis.net/fes/2.0%22%3E%0A %3Cfes:ValueReference%3EKanton%3C/fes:ValueReference%3E%0A %3Cfes:Literal xmlns:fes%3D%22http://www.opengis.net/fes/2.0%22%3EBE%3C/fes:Literal%3E%0A %3C/fes:PropertyIsEqualTo%3E%0A %3C/fes:And%3E%0A%3C/fes:Filter%3E%0A

returns the following error

<ows:ExceptionReport version="2.0.0" xml:lang="en-US" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"&gt;&lt;ows:Exception exceptionCode="OperationProcessingFailed" locator="mapserv"><ows:ExceptionText>msWFSGetFeature(): WFS server error. FLTApplyFilterToLayer() failed
msPostGISLayerWhichShapes(): Query error. Error executing query. Check server logs</ows:ExceptionText></ows:Exception></ows:ExceptionReport>

Same in WFS 1.1 with https://wfs.geodienste.ch/av/deu?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&TYPENAME=SOPT&SRSNAME=urn:ogc:def:crs:EPSG::2056&FILTER=%3Cogc:Filter%20xmlns:ogc%3D%22http://www.opengis.net/ogc%22%20xmlns:gml%3D%22http://www.opengis.net/gml%22%3E%0A%20%3Cogc:And%3E%0A%20%20%3Cogc:BBOX%3E%0A%20%20%20%3Cogc:PropertyName%3EmsGeometry%3C/ogc:PropertyName%3E%0A%20%20%20%3Cgml:Envelope%20srsName%3D%22urn:ogc:def:crs:EPSG::2056%22%3E%0A%20%20%20%20%3Cgml:lowerCorner%3E2427790%201059290%3C/gml:lowerCorner%3E%0A%20%20%20%20%3Cgml:upperCorner%3E2886430%201310890%3C/gml:upperCorner%3E%0A%20%20%20%3C/gml:Envelope%3E%0A%20%20%3C/ogc:BBOX%3E%0A%20%20%3Cogc:PropertyIsEqualTo%20xmlns:ogc%3D%22http://www.opengis.net/ogc%22%3E%0A%20%20%20%3Cogc:PropertyName%20xmlns:ogc%3D%22http://www.opengis.net/ogc%22%3EKanton%3C/ogc:PropertyName%3E%0A%20%20%20%3Cogc:Literal%20xmlns:ogc%3D%22http://www.opengis.net/ogc%22%3EBE%3C/ogc:Literal%3E%0A%20%20%3C/ogc:PropertyIsEqualTo%3E%0A%20%3C/ogc:And%3E%0A%3C/ogc:Filter%3E%0A

The workaround here is to disable "Only request features overlapping the view extent", but the issue is on the server

#4 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF