joey: thuban/Extensions/wms parser.py,1.9,1.10

cvs@intevation.de cvs at intevation.de
Tue Apr 13 21:28:08 CEST 2004


Author: joey

Update of /thubanrepository/thuban/Extensions/wms
In directory doto:/tmp/cvs-serv6570

Modified Files:
	parser.py 
Log Message:
Added support for oldstyle (WMS 1.0 apparently) image format specification.

Index: parser.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/wms/parser.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- parser.py	13 Apr 2004 17:21:19 -0000	1.9
+++ parser.py	13 Apr 2004 19:28:05 -0000	1.10
@@ -49,6 +49,7 @@
 # $Id$
 
 import xml.dom.minidom
+from xml.dom import Node
 
 from domutils import getElementsByName, getElementByName
 
@@ -118,11 +119,25 @@
                and foo.childNodes[0].data.lower() != 'none':
             self.access = foo.childNodes[0].data
         
-        # Extract output format information
-        foo = getElementsByName(
-            getElementByName(getElementByName(getElementByName(
-            root, 'Capability'), 'Request'), 'GetMap'), 'Format')
-        self.formats = map((lambda i: i.childNodes[0].data), foo)
+        foo = getElementByName(getElementByName(
+            root, 'Capability'), 'Request')
+
+        # Need to distinguish between Map and GetMap for v1.0 and v1.1
+        bar = getElementByName(foo, 'GetMap')
+        if bar:
+            # WMS 1.1
+            foo = getElementsByName(bar, 'Format')
+            self.formats = map((lambda i: i.childNodes[0].data), foo)
+        else:
+            # WMS 1.0
+            foo = getElementByName(getElementByName(
+                foo, 'Map'), 'Format')
+            for node in foo.childNodes:
+                if node.nodeType == Node.ELEMENT_NODE:
+                    try:
+                        self.formats.append(node.nodeName)
+                    except AttributeError:
+                        self.formats = [node.nodeName]
 
         # Extract layer names
         self.layers = []





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)