source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/ows/wcs_capabilities.kid @ 2978

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/ows/wcs_capabilities.kid@2978
Revision 2978, 6.8 KB checked in by domlowe, 12 years ago (diff)

couple of minor template changes

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<?python
3"""
4Implements WCS capabilities v1.1.0 based on the ows_common model.
5
6Assumes ows_common.ServiceMetadata() object at c.service_metadata.
7
8"""
9
10def set_tag(element, tag_name, namespace='http://www.opengis.net/wcs'):
11    """
12    A useful function for setting the tag-name of an element dynamically.
13
14    """
15    element.tag = '{%s}%s' % (namespace, tag_name)
16
17    return element
18
19def operation(opName, op):
20    """
21    A wrapper around the opXML template function to change the element name.
22
23    """
24    return set_tag(opXML(op), opName)
25
26
27?>
28<Capabilities xmlns:py="http://purl.org/kid/ns#" xmlns="http://www.opengis.net/wcs/1.1"              xmlns:ows="http://www.opengis.net/ows"  xmlns:owcs="http://www.opengis.net/wcs/1.1/ows"               xmlns:xlink="http://www.w3.org/1999/xlink"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"               xsi:schemaLocation="http://www.opengis.net/wcs/1.1   ../wcsGetCapabilities.xsd                               http://www.opengis.net/wcs/1.1/ows ../owsDataIdentification.xsd"   version="1.1.0" updateSequence="1.0">
29
30
31  <!--! Named template definitions -->
32  <owcs:Operation py:def="opXML(op)" name="${op.name}" >
33    <?python formats = op.parameters.get('Format') ?>
34    <owcs:DCP>
35        <owcs:HTTP>
36            <owcs:Get py:if="op.get is not None" xlink:type="simple" xlink:href="${op.get.href}">
37            </owcs:Get>
38            <owcs:Post py:if="op.post is not None" xlink:type="simple" xlink:href="${op.post.href}">
39            </owcs:Post>
40        </owcs:HTTP>
41        </owcs:DCP>   
42    <owcs:Parameter name="Format">   
43        <owcs:AllowedValues>
44            <owcs:Value py:if="formats is not None"
45               py:for="f in formats.possibleValues.allowedValues"
46               py:content="f"/>
47        </owcs:AllowedValues>
48    </owcs:Parameter>
49  </owcs:Operation>
50
51
52
53  <CoverageSummary py:def="coverageSummary(ds)">
54    <!--!  coverageSummary comes from wmsDatasetSummary  TODO   -->
55    <ows:Title py:if="ds.titles is not None" py:content="ds.titles"/>       
56    <ows:Abstract py:if="ds.abstracts is not None" py:content="ds.abstracts"/>   
57    <ows:Keywords>
58        <ows:Keyword>NONE</ows:Keyword>
59    </ows:Keywords>
60    <ows:WGS84BoundingBox py:for="bb in ds.boundingBoxes">
61            <ows:LowerCorner>${bb.lowerCorner[0]} ${bb.lowerCorner[1]}</ows:LowerCorner>                 
62            <ows:UpperCorner>${bb.upperCorner[0]} ${bb.upperCorner[1]}</ows:UpperCorner>       
63    </ows:WGS84BoundingBox>   
64    <SupportedCRS py:for="crs in ds.supportedCRSs"
65                py:content="crs"/>   
66    <SupportedFormat py:for="format in ds.formats"
67                py:content="format"/>
68    <Identifier py:if="ds.identifier is not None" py:content="ds.identifier"/>
69    <CoverageSummary py:for="ds1 in ds.datasetSummaries" py:replace="coverageSummary(ds1)"/>
70  </CoverageSummary>
71
72
73
74
75
76  <!--! Main body -->
77  <?python
78  sm = c.service_metadata
79  si = c.service_metadata.serviceIdentification   
80  ?>
81  <!--***************************************-->
82  <!--*     Service Identification          *-->
83  <!--***************************************-->
84  <owcs:ServiceIdentification>
85    <ows:Title py:content="si.titles[0]"/>
86    <ows:Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
87    <ows:Keywords>
88    <ows:Keyword py:for="kw in si.keywords"
89               py:content="kw"/>
90    </ows:Keywords>
91    <owcs:ServiceType>OCG WCS</owcs:ServiceType>
92    <owcs:ServiceTypeVersion>1.1.0</owcs:ServiceTypeVersion>
93    <owcs:Fees py:content="si.fees"/>
94    <owcs:AccessConstraints py:content="si.accessConstraints"/>
95   </owcs:ServiceIdentification>
96  <!--***************************************-->
97  <!--*        Service Provider             *-->
98  <!--***************************************-->
99    <ows:ServiceProvider py:if="sm.serviceProvider is not None">
100      <?python rp = sm.serviceProvider.serviceContact ?>
101      <ows:ProviderName py:content="sm.serviceProvider.providerName"/>     
102      <ows:ServiceContact>
103        <ows:IndividualName py:if="rp is not None" py:content="rp.individualName"/>
104        <ows:PositionName py:content="rp.positionName"/>     
105        <?python cn = rp.contactInfo ?>
106        <div py:if="cn is not None" py:strip="1">
107            <ows:ContactInfo>   
108                <ows:Phone>
109                    <ows:Voice py:if="cn.phone is not None"
110                                py:content="cn.phone.voice"/>
111                    <ows:Facsimile py:if="cn.phone is not None"
112                                    py:content="cn.phone.facsimile"/>
113                </ows:Phone>                       
114                <ows:Address py:if="cn.address is not None">
115                    <ows:DeliveryPoint py:for="d in cn.address.deliveryPoints" py:content="d"/>
116                    <ows:City py:content="cn.address.city"/>
117                    <ows:AdministrativeArea py:content="cn.address.administrativeArea"/>
118                    <ows:PostalCode py:content="cn.address.postalCode"/>
119                    <ows:Country py:content="cn.address.country"/>                                   
120                    <ows:ElectronicMailAddress py:if="cn.address is not None"
121                                        py:content="cn.address.electronicMailAddress"/>
122                </ows:Address>               
123          </ows:ContactInfo>           
124        </div>     
125      </ows:ServiceContact>
126     
127     
128     
129    </ows:ServiceProvider>
130    <!--! These fields are represented in ows_common as service constraints -->
131    <?python om = sm.operationsMetadata ?>
132    <LayerLimit py:if="'LayerLimit' in om.constraints"
133                py:content="om.constraints['LayerLimit'].possibleValues.allowedValues[0]"/>
134    <MaxWidth py:if="'MaximumWidth' in om.constraints"
135              py:content="om.constraints['MaximumWidth'].possibleValues.allowedValues[0]"/>
136    <MinWidth py:if="'MinimumWidth' in om.constraints"
137              py:content="om.constraints['MinimumWidth'].possibleValues.allowedValues[0]"/>
138
139<!--***************************************-->
140<!--*       Operations                    *-->
141<!--***************************************-->
142    <owcs:OperationsMetadata>
143        <ops py:for="opName, op in om.operationDict.items()"
144             py:content="operation(opName, op)"
145             py:strip="1"/>
146      <?python exceptions = op.parameters.get('ExceptionFormat') ?>
147      <Exception py:if="exceptions is not None">
148        <Format py:for="e in exceptions.possibleValues.allowedValues"
149                py:content="e"/>
150      </Exception>
151     <!--! <Layer py:replace="layer(sm.contents.datasetSummaries[0])"/> -->
152    </owcs:OperationsMetadata>
153<!--***************************************-->
154  <!--*        Contents                     *-->
155  <!--***************************************--> 
156  <Contents>
157        <CoverageSummary py:replace="coverageSummary(sm.contents.datasetSummaries[0])"/>
158  </Contents>
159</Capabilities>
Note: See TracBrowser for help on using the repository browser.