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

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

adding comments to wcs capabilities template

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:Parameter name="Format">   
35        <owcs:AllowedValues>
36            <owcs:Value py:if="formats is not None"
37               py:for="f in formats.possibleValues.allowedValues"
38               py:content="f"/>
39        </owcs:AllowedValues>
40    </owcs:Parameter>
41    <owcs:DCP>
42      <owcs:HTTP>
43        <owcs:Get py:if="op.get is not None" xlink:type="simple" xlink:href="${op.get.href}">
44        </owcs:Get>
45        <owcs:Post py:if="op.post is not None" xlink:type="simple" xlink:href="${op.post.href}">
46        </owcs:Post>
47      </owcs:HTTP>
48    </owcs:DCP>
49  </owcs:Operation>
50
51
52
53  <CoverageSummary py:def="coverageSummary(ds)">
54    <!--!  coverageSummary comes from wmsDatasetSummary  TODO   -->
55    <Identifier py:if="ds.identifier is not None" py:content="ds.identifier"/>
56    <Description py:if="ds.description is not None" py:content="ds.description"/>
57    <ows:Title py:if="ds.titles is not None" py:content="ds.titles"/>       
58    <ows:Abstract py:if="ds.abstracts is not None" py:content="ds.abstracts"/>   
59    <ows:Keywords>
60    </ows:Keywords>
61    <ows:WGS84BoundingBox py:for="bb in ds.boundingBoxes">
62            <ows:LowerCorner>${bb.lowerCorner[0]} ${bb.lowerCorner[1]}</ows:LowerCorner>                 
63            <ows:UpperCorner>${bb.upperCorner[0]} ${bb.upperCorner[1]}</ows:UpperCorner>       
64    </ows:WGS84BoundingBox>   
65    <SupportedCRS py:for="crs in ds.supportedCRSs"
66                py:content="crs"/>   
67    <SupportedFormat py:for="format in ds.formats"
68                py:content="format"/>
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:Name>WCS</ows:Name>
86    <ows:Title py:content="si.titles[0]"/>
87    <ows:Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
88    <ows:Keywords>
89      <ows:Keyword py:for="kw in si.keywords"
90               py:content="kw"/>
91    </ows:Keywords>
92    <owcs:ServiceType>OCG WCS</owcs:ServiceType>
93    <owcs:ServiceTypeVersion>1.1.0</owcs:ServiceTypeVersion>
94    <owcs:Fees py:content="si.fees"/>
95    <owcs:AccessConstraints py:content="si.fees"/>
96    <AccessConstraints py:content="si.accessConstraints"/>
97   </owcs:ServiceIdentification>
98  <!--***************************************-->
99  <!--*        Service Provider             *-->
100  <!--***************************************-->
101    <ows:ServiceProvider py:if="sm.serviceProvider is not None">
102      <?python rp = sm.serviceProvider.serviceContact ?>
103      <ows:ProviderName py:content="sm.serviceProvider.providerName"/>     
104      <ows:ServiceContact>
105        <ows:IndividualName py:if="rp is not None" py:content="rp.individualName"/>
106        <ows:PositionName py:content="rp.positionName"/>     
107        <?python cn = rp.contactInfo ?>
108        <div py:if="cn is not None" py:strip="1">
109            <ows:ContactInfo>   
110                <ows:Phone>
111                    <ows:Voice py:if="cn.phone is not None"
112                                py:content="cn.phone.voice"/>
113                    <ows:Facsimile py:if="cn.phone is not None"
114                                    py:content="cn.phone.facsimile"/>
115                </ows:Phone>                       
116                <ows:Address py:if="cn.address is not None">
117                    <ows:DeliveryPoint>                 
118                    <span py:for="d in cn.address.deliveryPoints" py:replace="d"/>
119                    </ows:DeliveryPoint>
120                    <ows:City py:content="cn.address.city"/>
121                    <ows:AdministrativeArea py:content="cn.address.administrativeArea"/>
122                    <ows:PostalCode py:content="cn.address.postalCode"/>
123                    <ows:Country py:content="cn.address.country"/>                                   
124                    <ows:ElectronicMailAddress py:if="cn.address is not None"
125                                        py:content="cn.address.electronicMailAddress"/>
126                </ows:Address>               
127          </ows:ContactInfo>           
128        </div>     
129      </ows:ServiceContact>
130     
131     
132     
133    </ows:ServiceProvider>
134    <!--! These fields are represented in ows_common as service constraints -->
135    <?python om = sm.operationsMetadata ?>
136    <LayerLimit py:if="'LayerLimit' in om.constraints"
137                py:content="om.constraints['LayerLimit'].possibleValues.allowedValues[0]"/>
138    <MaxWidth py:if="'MaximumWidth' in om.constraints"
139              py:content="om.constraints['MaximumWidth'].possibleValues.allowedValues[0]"/>
140    <MinWidth py:if="'MinimumWidth' in om.constraints"
141              py:content="om.constraints['MinimumWidth'].possibleValues.allowedValues[0]"/>
142
143<!--***************************************-->
144<!--*       Operations                    *-->
145<!--***************************************-->
146    <owcs:OperationsMetadata>
147        <ops py:for="opName, op in om.operationDict.items()"
148             py:content="operation(opName, op)"
149             py:strip="1"/>
150      <?python exceptions = op.parameters.get('ExceptionFormat') ?>
151      <Exception py:if="exceptions is not None">
152        <Format py:for="e in exceptions.possibleValues.allowedValues"
153                py:content="e"/>
154      </Exception>
155     <!--! <Layer py:replace="layer(sm.contents.datasetSummaries[0])"/> -->
156    </owcs:OperationsMetadata>
157<!--***************************************-->
158  <!--*        Contents                     *-->
159  <!--***************************************--> 
160  <Contents>
161        <CoverageSummary py:replace="coverageSummary(sm.contents.datasetSummaries[0])"/>
162  </Contents>
163</Capabilities>
Note: See TracBrowser for help on using the repository browser.