[owslib-users] parsing xml capabilities file

Tom Kralidis tomkralidis at hotmail.com
Mon Mar 26 18:03:14 PDT 2012




> Date: Sun, 25 Mar 2012 12:21:24 -0700
> From: nick.gart at gmail.com
> To: owslib-users at lists.sourceforge.net
> Subject: [owslib-users] parsing xml capabilities file
> 
> I am trying to create a WebMapService from this url:
> http://imselev.cr.usgs.gov/WMS_Capabilities/USGS_EDC_Elev_NED_3/capabilities_1_3_0.xml
> 
> but it doesn't seem to be parsing correctly:
> 
> 
>   File "<stdin>", line 1, in <module>
>   File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 86, in __init__
>     self._buildMetadata(parse_remote_metadata)
>   File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 101, in _buildMetadata
>     self.identification=ServiceIdentification(serviceelem, self.version)
>   File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 267, in __init__
>     self.type = testXMLValue(self._root.find('Name'))
> AttributeError: 'NoneType' object has no attribute 'find'
> 
> 
> Since the URl isn't a CGI link, I tried pulling the XML and feeding
> that in as XML too:
> 
> 
> >>> capurl = urllib2.urlopen('http://imselev.cr.usgs.gov/WMS_Capabilities/USGS_EDC_Elev_NED_3/capabilities_1_3_0.xml').readlines()
> >>>capstring = "".join(capurl)
> >>> wms = WebMapService('',xml=capstring)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 86, in __init__
>     self._buildMetadata(parse_remote_metadata)
>   File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 101, in _buildMetadata
>     self.identification=ServiceIdentification(serviceelem, self.version)
>   File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 267, in __init__
>     self.type = testXMLValue(self._root.find('Name'))
> AttributeError: 'NoneType' object has no attribute 'find'
> 
> 
> Am I going about this properly?

Nick: owslib doesn't support WMS 1.3.0 as of yet.  If you would like to see support, please file a ticket in https://sourceforge.net/apps/trac/owslib.  Not sure how much work this would be, given the differences between 1.1.1 and 1.3.0.

Cheers

..Tom

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/owslib-users/attachments/20120326/a2c694f5/attachment.html>


More information about the Owslib-users mailing list