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

View file

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

View file

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