ogcserver: apply patch from crschmidt to support correct layer ordering in GetCaps response (closes #226)

This commit is contained in:
Dane Springmeyer 2009-02-19 18:02:17 +00:00
parent 3c1b67ccd4
commit 06e073c7ba
3 changed files with 4 additions and 2 deletions

View file

@ -40,6 +40,7 @@ def ServiceHandlerFactory(conf, mapfactory, onlineresource, version):
class BaseWMSFactory:
def __init__(self):
self.layers = {}
self.ordered_layers = []
self.styles = {}
self.aggregatestyles = {}
@ -85,6 +86,7 @@ class BaseWMSFactory:
layer.wmsextrastyles = extrastyles
else:
raise ServerConfigurationError('Layer "%s" was passed an invalid list of extra styles. List must be a tuple of strings.' % layername)
self.ordered_layers.append(layer)
self.layers[layername] = layer
def register_style(self, name, style):

View file

@ -152,7 +152,7 @@ class ServiceHandler(WMSBaseServiceHandler):
rootlayercrs.text = epsgcode.upper()
rootlayerelem.append(rootlayercrs)
for layer in self.mapfactory.layers.values():
for layer in self.mapfactory.ordered_layers:
layerproj = Projection(layer.srs)
layername = ElementTree.Element('Name')
layername.text = layer.name

View file

@ -158,7 +158,7 @@ class ServiceHandler(WMSBaseServiceHandler):
rootlayercrs.text = epsgcode.upper()
rootlayerelem.append(rootlayercrs)
for layer in self.mapfactory.layers.values():
for layer in self.mapfactory.ordered_layers:
layerproj = Projection(layer.srs)
layername = ElementTree.Element('Name')
layername.text = layer.name