/[thuban]/branches/WIP-pyshapelib-bramz/Extensions/wms/parser.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Extensions/wms/parser.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2170 by joey, Tue Apr 13 17:21:19 2004 UTC revision 2439 by joey, Thu Dec 9 10:37:44 2004 UTC
# Line 40  class WMSCapabilitiesParser: Line 40  class WMSCapabilitiesParser:
40      getLayerBBox(layer, srs)      getLayerBBox(layer, srs)
41    
42      isQueryable(layer)      isQueryable(layer)
   
     get_srs_discrepancies()  
43  """  """
44    
45  __version__ = "$Revision$"  __version__ = "$Revision$"
# Line 49  __version__ = "$Revision$" Line 47  __version__ = "$Revision$"
47  # $Id$  # $Id$
48    
49  import xml.dom.minidom  import xml.dom.minidom
50    from xml.dom import Node
51    
52  from domutils import getElementsByName, getElementByName  from domutils import getElementsByName, getElementByName
53    
# Line 69  class WMSCapabilitiesParser: Line 68  class WMSCapabilitiesParser:
68      fees = None      fees = None
69      access = None      access = None
70      formats = None      formats = None
     srs_discrepancies = None  
71      error = None      error = None
72    
73    
# Line 118  class WMSCapabilitiesParser: Line 116  class WMSCapabilitiesParser:
116                 and foo.childNodes[0].data.lower() != 'none':                 and foo.childNodes[0].data.lower() != 'none':
117              self.access = foo.childNodes[0].data              self.access = foo.childNodes[0].data
118                    
119          # Extract output format information          foo = getElementByName(getElementByName(
120          foo = getElementsByName(              root, 'Capability'), 'Request')
121              getElementByName(getElementByName(getElementByName(  
122              root, 'Capability'), 'Request'), 'GetMap'), 'Format')          # Need to distinguish between Map and GetMap for v1.0 and v1.1
123          self.formats = map((lambda i: i.childNodes[0].data), foo)          bar = getElementByName(foo, 'GetMap')
124            if bar:
125                # WMS 1.1
126                foo = getElementsByName(bar, 'Format')
127                self.formats = map((lambda i: i.childNodes[0].data), foo)
128            else:
129                # WMS 1.0
130                foo = getElementByName(getElementByName(
131                    foo, 'Map'), 'Format')
132                for node in foo.childNodes:
133                    if node.nodeType == Node.ELEMENT_NODE:
134                        try:
135                            self.formats.append(node.nodeName)
136                        except AttributeError:
137                            self.formats = [node.nodeName]
138    
139          # Extract layer names          # Extract layer names
140          self.layers = []          self.layers = []
# Line 492  class WMSCapabilitiesParser: Line 504  class WMSCapabilitiesParser:
504          return 0          return 0
505    
506    
     def get_srs_discrepancies(self):  
         """  
         Returns a list of layer identifications where the denoted SRS  
         values differ from the calculated ones through BoundingBox  
         elements.  
         """  
         return self.srs_discrepancies  
   
507    
508  if __name__ == "__main__":  if __name__ == "__main__":
509      print "This module cannot be executed standalone."      print "This module cannot be executed standalone."

Legend:
Removed from v.2170  
changed lines
  Added in v.2439

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26