From 06e073c7ba0d6cb873fa1b42741abfe34b0a74f7 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 19 Feb 2009 18:02:17 +0000 Subject: [PATCH] ogcserver: apply patch from crschmidt to support correct layer ordering in GetCaps response (closes #226) --- bindings/python/mapnik/ogcserver/WMS.py | 2 ++ bindings/python/mapnik/ogcserver/wms111.py | 2 +- bindings/python/mapnik/ogcserver/wms130.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) 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