diff --git a/bindings/python/mapnik/ogcserver/WMS.py b/bindings/python/mapnik/ogcserver/WMS.py index 3630dffa4..f7e224505 100644 --- a/bindings/python/mapnik/ogcserver/WMS.py +++ b/bindings/python/mapnik/ogcserver/WMS.py @@ -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): diff --git a/bindings/python/mapnik/ogcserver/wms111.py b/bindings/python/mapnik/ogcserver/wms111.py index a652b142d..fc37527d4 100644 --- a/bindings/python/mapnik/ogcserver/wms111.py +++ b/bindings/python/mapnik/ogcserver/wms111.py @@ -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 diff --git a/bindings/python/mapnik/ogcserver/wms130.py b/bindings/python/mapnik/ogcserver/wms130.py index 645d7b217..25d6ab9d8 100644 --- a/bindings/python/mapnik/ogcserver/wms130.py +++ b/bindings/python/mapnik/ogcserver/wms130.py @@ -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