source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wms.py @ 2507

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wms.py@2507
Revision 2507, 1.8 KB checked in by spascoe, 12 years ago (diff)

Operations metadata inserted correctly for CSML WMS.

Line 
1# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
2# This software may be distributed under the terms of the
3# Q Public License, version 1.0 or later.
4# http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
5"""
6Example WMS controller driven by CSML.
7
8@author: Stephen Pascoe
9"""
10from ows_server.lib.base import *
11from ows_server.controllers.csml_api import get_csml_doc
12from elementtree import ElementTree as ET
13from ows_common import exceptions as OWS_E
14from ows_common.decorators import *
15from ows_server.lib.csml_util import get_csml_doc
16
17class CsmlWmsController(OwsController):
18
19    _ows_parameters = {
20        'Format': make_domain(['text/xml']),
21        'ExceptionFormat': make_domain(['text/xml']),
22        }
23
24    #_ows_constraints = {
25        # MaximumLayerLevels
26        # MaximumWidth
27        # MaximumWidth
28    #    }
29   
30    @operation
31    @parameter('Format', possibleValues=['text/xml'])
32    def GetCapabilities(self, file, service=None, version=None):
33        """
34        @note: format and updatesequence parameters are not supported
35            by this WMS.
36
37        """
38
39        if service is None:
40            raise OWS_E.MissingParameterValue('SERVICE parameter not specified',
41                                              'SERVICE')
42        if service != 'WMS':
43            raise OWS_E.InvalidParameterValue('SERVICE parameter must be "WMS"',
44                                              'SERVICE')
45       
46        ows_c_file = request.environ['paste.config']['app_conf']['ows_common_config']
47        c.ows_c = ET.parse(ows_c_file).getroot()
48        c.dataset = get_csml_doc(file)
49        c.ows_capabilities = self._load_capabilities(
50            h.url_for(controller='csml_wms', file=file)
51            )
52       
53        return render_response('wms_service_metadata', format='xml')
Note: See TracBrowser for help on using the repository browser.