49 |
# $Id$ |
# $Id$ |
50 |
|
|
51 |
import xml.dom.minidom |
import xml.dom.minidom |
52 |
|
from xml.dom import Node |
53 |
|
|
54 |
from domutils import getElementsByName, getElementByName |
from domutils import getElementsByName, getElementByName |
55 |
|
|
119 |
and foo.childNodes[0].data.lower() != 'none': |
and foo.childNodes[0].data.lower() != 'none': |
120 |
self.access = foo.childNodes[0].data |
self.access = foo.childNodes[0].data |
121 |
|
|
122 |
# Extract output format information |
foo = getElementByName(getElementByName( |
123 |
foo = getElementsByName( |
root, 'Capability'), 'Request') |
124 |
getElementByName(getElementByName(getElementByName( |
|
125 |
root, 'Capability'), 'Request'), 'GetMap'), 'Format') |
# Need to distinguish between Map and GetMap for v1.0 and v1.1 |
126 |
self.formats = map((lambda i: i.childNodes[0].data), foo) |
bar = getElementByName(foo, 'GetMap') |
127 |
|
if bar: |
128 |
|
# WMS 1.1 |
129 |
|
foo = getElementsByName(bar, 'Format') |
130 |
|
self.formats = map((lambda i: i.childNodes[0].data), foo) |
131 |
|
else: |
132 |
|
# WMS 1.0 |
133 |
|
foo = getElementByName(getElementByName( |
134 |
|
foo, 'Map'), 'Format') |
135 |
|
for node in foo.childNodes: |
136 |
|
if node.nodeType == Node.ELEMENT_NODE: |
137 |
|
try: |
138 |
|
self.formats.append(node.nodeName) |
139 |
|
except AttributeError: |
140 |
|
self.formats = [node.nodeName] |
141 |
|
|
142 |
# Extract layer names |
# Extract layer names |
143 |
self.layers = [] |
self.layers = [] |
185 |
if srs[0:5] == 'EPSG:': |
if srs[0:5] == 'EPSG:': |
186 |
srs = srs[5:] |
srs = srs[5:] |
187 |
try: |
try: |
188 |
self.layers[index]['srs'].append(srs) |
int(srs) |
189 |
except KeyError: |
try: |
190 |
self.layers[index]['srs'] = [srs] |
self.layers[index]['srs'].append(srs) |
191 |
|
except KeyError: |
192 |
|
self.layers[index]['srs'] = [srs] |
193 |
|
except ValueError: |
194 |
|
if srs[0:4].upper() == 'AUTO' \ |
195 |
|
or srs[0:4].upper() == 'NONE': |
196 |
|
try: |
197 |
|
self.layers[index]['_srs_'].append(srs) |
198 |
|
except KeyError: |
199 |
|
self.layers[index]['_srs_'] = [srs] |
200 |
|
else: |
201 |
|
self.error.append(_("SRS '%s' is not numerical and not" |
202 |
|
" AUTO/NONE in layer '%s'") \ |
203 |
|
% (srs, self.layers[index]['title'])) |
204 |
|
|
205 |
foo = getElementByName(top, 'LatLonBoundingBox') |
foo = getElementByName(top, 'LatLonBoundingBox') |
206 |
if foo is not None: |
if foo is not None: |
473 |
if srs in pivot['bbox']: |
if srs in pivot['bbox']: |
474 |
return pivot['bbox'][srs] |
return pivot['bbox'][srs] |
475 |
|
|
476 |
|
# No matching BBox found, let's see if it was EPSG:4326 |
477 |
|
if srs == '4326': |
478 |
|
return self.getLayerLatLonBBox(name) |
479 |
|
|
480 |
return None |
return None |
481 |
|
|
482 |
|
|