Bug report #14250

QGIS server WFS response not parsed by OWSLib

Added by Gavin Fleming about 8 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:René-Luc ReLuc
Category:QGIS Server
Affected QGIS version:2.8.5 Regression?:No
Operating System:ubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:22246

Description

We have had to resort to parsing WFS XML responses since there seems to be some keyword case sensitivity in either QGIS server or OWSLib that's preventing unfettered OGC communication.

I wasn't able to diagnose if the problem is with QGIS or OWSLib

GetCapabilities.xml Magnifier (16.9 KB) Gavin Fleming, 2016-03-29 07:42 AM

History

#1 Updated by Jukka Rahkonen about 8 years ago

It would be much easier to analyze if the XML from QGIS server is valid if you could add a sample.

#2 Updated by René-Luc ReLuc about 8 years ago

  • Assignee set to René-Luc ReLuc

#3 Updated by Gavin Fleming almost 8 years ago

GetCapabilities XML attached.

By the way, this is the response when I try to use OWSLib:
Based on the documentation, they have three WFS versions supported:

Version 1.0.0
```

from owslib.wfs import WebFeatureService
wfs11 = WebFeatureService(url='http://129.232.164.58:6003/cgi-bin/qgis_mapserv.fcgi?map=/qgis/docs/projects/straffontein_SCH032.qgs', version='1.0.0')

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/owslib/wfs.py", line 36, in WebFeatureService
timeout=timeout)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs100.py", line 72, in new
obj.__init__(url, version, xml, parse_remote_metadata, timeout)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs100.py", line 94, in init
self._buildMetadata(parse_remote_metadata)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs100.py", line 104, in _buildMetadata
self.provider=ServiceProvider(serviceelem)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs100.py", line 283, in init
self.keywords = extract_xml_list(self._root.find(nspath('Keywords')))
File "/usr/local/lib/python2.7/site-packages/owslib/util.py", line 540, in extract_xml_list
keywords = [re.split(r'[\
\
]+',f.text) for f in elements if f.text]
TypeError: 'NoneType' object is not iterable

```

Version 1.1.0

```

from owslib.wfs import WebFeatureService
wfs11 = WebFeatureService(url='http://129.232.164.58:6003/cgi-bin/qgis_mapserv.fcgi?map=/qgis/docs/projects/straffontein_SCH032.qgs', version='1.1.0')

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/owslib/wfs.py", line 39, in WebFeatureService
timeout=timeout)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs110.py", line 53, in new
obj.__init__(url, version, xml, parse_remote_metadata, timeout)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs110.py", line 76, in init
self._buildMetadata(parse_remote_metadata)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs110.py", line 83, in _buildMetadata
self.identification=ServiceIdentification(val,self.owscommon.namespace)
File "/usr/local/lib/python2.7/site-packages/owslib/ows.py", line 47, in init
val = self._root.find(util.nspath('Title', namespace))
AttributeError: 'NoneType' object has no attribute 'find'

```

Version 2.0.0

```

from owslib.wfs import WebFeatureService

wfs11 = WebFeatureService(url='http://129.232.164.58:6003/cgi-bin/qgis_mapserv.fcgi?map=/qgis/docs/projects/straffontein_SCH032.qgs', version='2.0.0')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/owslib/wfs.py", line 42, in WebFeatureService
timeout=timeout)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs200.py", line 61, in new
obj.__init__(url, version, xml, parse_remote_metadata, timeout)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs200.py", line 85, in init
self._buildMetadata(parse_remote_metadata)
File "/usr/local/lib/python2.7/site-packages/owslib/feature/wfs200.py", line 92, in _buildMetadata
self.identification=ServiceIdentification(serviceidentelem)
File "/usr/local/lib/python2.7/site-packages/owslib/ows.py", line 47, in init
val = self._root.find(util.nspath('Title', namespace))
AttributeError: 'NoneType' object has no attribute 'find'

```

#4 Updated by René-Luc ReLuc almost 8 years ago

QGIS Server only provides WFS version 1.0.0.

It seems that OWSLib is waiting for Keywords in capabilities.

#5 Updated by Giovanni Manghi almost 7 years ago

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

#6 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF