I have been trying to use OWSLib to access a WMS server (
http://www.ipcc-data.org/maps/wms/tar), but it is triggering an error.

$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from owslib.wms import WebMapService
>>> wms = WebMapService('http://www.ipcc-data.org/maps/wms/tar',
version='1.1.1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/OWSLib/trunk/owslib/wms.py", line 80, in __init__
    self._buildMetadata()
  File "/usr/local/OWSLib/trunk/owslib/wms.py", line 95, in _buildMetadata
    self.identification=ServiceIdentification(serviceelem, self.version)
  File "/usr/local/OWSLib/trunk/owslib/wms.py", line 248, in __init__
    self.type = self._root.find('Name').text
AttributeError: 'NoneType' object has no attribute 'find'
>>>

The error seems to be related to having a default XML namespace (xmlns="
http://www.opengis.net/wms";) defined in the root element of the
GetCapabilites document.

<?xml version="1.0" encoding="utf-8"?>
<WMS_Capabilities version="1.1.1" xmlns="http://www.opengis.net/wms";
xmlns:xlink="http://www.w3.org/1999/xlink/";>

Within owslib/wms.py there are many occurrences of find() and findall)
statements that attempt to extract elements, but they fail to return
elements because they do not include the default namespace.  I started
modifying all the find() and findall() names to include the default
namespace (if the GetCapabilities response has one), but this will require
many changes to wms.py.

Is there already a way to account for a default namespace in the
GetCapabilities response?  And it not, any suggestions for how the code
should be modified to account for the default namespace?

- Tyler
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

Reply via email to