Changeset 3571


Ignore:
Timestamp:
10/03/08 14:30:21 (11 years ago)
Author:
spascoe
Message:

Basic support for WebMapContext? documents.

Location:
TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/wms_capabilities_1_1_1.xml

    r3569 r3571  
    55<?python 
    66 
    7 from genshi.builder import tag, Element 
    87from ows_common.pylons.genshi_util import RenameElementFilter 
    98from genshi import QName 
    109import webhelpers as h 
    11 import sets 
    1210 
    1311?> 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/wms_controller.py

    r3569 r3571  
    4343 
    4444    service = 'WMS' 
    45     owsOperations = ows_controller.OWSController.owsOperations + ['GetMap', 'GetInfo'] 
     45    owsOperations = ows_controller.OWSController.owsOperations + ['GetMap', 'GetContext', 
     46                                                                  'GetInfo'] 
    4647    validVersions = ['1.1.1'] 
    4748 
     
    204205        return request 
    205206 
     207    def GetContext(self): 
     208        """ 
     209        Return a WebMap Context document for a given set of layers. 
     210 
     211        """ 
     212        # Parameters 
     213        layers = self.getOwsParam('layers', default=None) 
     214 
     215        # Filter self.layers for selected layers 
     216        if layers is not None: 
     217            newLayerMap = {} 
     218            for layerName in layers.split(','): 
     219                try: 
     220                    newLayerMap[layerName] = self.layers[layerName] 
     221                except KeyError: 
     222                    raise InvalidParameterValue('Layer %s not found' % layerName, 
     223                                                'layers') 
     224                     
     225            self.layers = newLayerMap 
     226 
     227        # Automatically select the first bbox/crs for the first layer 
     228        aLayer = self.layers.values()[0] 
     229        crs = aLayer.crss[0] 
     230        bb = aLayer.getBBox(crs) 
     231        c.bbox = BoundingBox(bb[:2], bb[2:], crs) 
     232 
     233        # Initialise as if doing GetCapabilities 
     234        ows_controller.initCapabilities() 
     235        self._loadCapabilities() 
     236 
     237        response.headers['Content-Type'] = 'text/xml' 
     238        t = ows_controller.templateLoader.load('wms_context_1_1_1.xml') 
     239        return t.generate(c=c).render() 
     240 
     241 
    206242    def GetInfo(self): 
    207243        from pprint import pformat 
Note: See TracChangeset for help on using the changeset viewer.