source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/wcs1_0_capabilities.kid @ 2917

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/wcs1_0_capabilities.kid@2917
Revision 2917, 6.0 KB checked in by domlowe, 13 years ago (diff)

changes to template for 1.0

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    return element
17
18def operation(opName, op):
19    """
20    A wrapper around the opXML template function to change the element name.
21
22    """
23   
24    return set_tag(opXML(op), opName)
25
26?>
27<WCS_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.0.0" updateSequence="1.0">
28
29
30  <!--! Named template definitions -->
31    <Xname py:def="opXML(op)" name="${op.name}">
32    <?python formats = op.parameters.get('Format') ?>
33    <DCPType >
34        <HTTP>
35            <Get py:if="op.get is not None" xlink:type="simple" xlink:href="${op.get.href}">
36            </Get>
37            <Post py:if="op.post is not None" xlink:type="simple" xlink:href="${op.post.href}">
38            </Post>
39        </HTTP>
40        </DCPType>   
41    <owcs:Parameter name="Format">   
42        <owcs:AllowedValues>
43            <owcs:Value py:if="formats is not None"
44               py:for="f in formats.possibleValues.allowedValues"
45               py:content="f"/>
46        </owcs:AllowedValues>
47    </owcs:Parameter>
48    </Xname>
49
50
51
52  <CoverageSummary py:def="coverageSummary(ds)">
53    <!--!  coverageSummary comes from wmsDatasetSummary  TODO   -->
54    <ows:Title py:if="ds.titles is not None" py:content="ds.titles"/>       
55    <ows:Abstract py:if="ds.abstracts is not None" py:content="ds.abstracts"/>   
56    <ows:Keywords>
57        <ows:Keyword>NONE</ows:Keyword>
58    </ows:Keywords>
59    <ows:WGS84BoundingBox py:for="bb in ds.boundingBoxes">
60            <ows:LowerCorner>${bb.lowerCorner[0]} ${bb.lowerCorner[1]}</ows:LowerCorner>                 
61            <ows:UpperCorner>${bb.upperCorner[0]} ${bb.upperCorner[1]}</ows:UpperCorner>       
62    </ows:WGS84BoundingBox>   
63    <SupportedCRS py:for="crs in ds.supportedCRSs"
64                py:content="crs"/>   
65    <SupportedFormat py:for="format in ds.formats"
66                py:content="format"/>
67    <Identifier py:if="ds.identifier is not None" py:content="ds.identifier"/>
68    <CoverageSummary py:for="ds1 in ds.datasetSummaries" py:replace="coverageSummary(ds1)"/>
69  </CoverageSummary>
70
71
72
73
74
75  <!--! Main body -->
76  <?python
77  sm = c.service_metadata
78  si = c.service_metadata.serviceIdentification   
79  ?>
80  <!--***************************************-->
81  <!--*     Service                         *-->
82  <!--***************************************-->
83  <Service>
84    <description py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>   
85    <name>tba</name>
86    <label py:content="si.titles[0]"/>
87    <keywords>
88        <keyword py:for="kw in si.keywords"
89               py:content="kw"/>
90    </keywords>
91    <!--! <owcs:ServiceType>OCG WCS</owcs:ServiceType> -->
92    <!--! <owcs:ServiceTypeVersion>1.1.0</owcs:ServiceTypeVersion> -->
93    <fees py:content="si.fees"/>
94    <accessConstraints py:content="si.accessConstraints"/>
95    <ResponsibleParty py:if="sm.serviceProvider is not None">
96      <?python rp = sm.serviceProvider.serviceContact ?>
97      <organisationName py:content="sm.serviceProvider.providerName"/>     
98      <individualName py:if="rp is not None" py:content="rp.individualName"/>
99      <positionName py:content="rp.positionName"/>     
100        <?python cn = rp.contactInfo ?>
101        <div py:if="cn is not None" py:strip="1">
102            <contactInfo>   
103                <phone>
104                    <voice py:if="cn.phone is not None"
105                                py:content="cn.phone.voice"/>
106                    <facsimile py:if="cn.phone is not None"
107                                    py:content="cn.phone.facsimile"/>
108                </phone>                       
109                <address py:if="cn.address is not None">
110                    <deliveryPoint>                 
111                    <span py:for="d in cn.address.deliveryPoints" py:replace="d"/>
112                    </deliveryPoint>
113                    <city py:content="cn.address.city"/>
114                    <administrativeArea py:content="cn.address.administrativeArea"/>
115                    <postalCode py:content="cn.address.postalCode"/>
116                    <country py:content="cn.address.country"/>                                   
117                    <electronicMailAddress py:if="cn.address is not None"
118                                        py:content="cn.address.electronicMailAddress"/>
119                </address>               
120          </contactInfo>           
121        </div>         
122    </ResponsibleParty>
123  </Service>
124
125<!--***************************************-->
126<!--*       Capability                    *-->
127<!--***************************************-->
128    <?python om = sm.operationsMetadata ?>
129    <Capability>
130        <Request py:for="opName, op in om.operationDict.items()"
131             py:content="operation(opName, op)"/>
132      <?python exceptions = op.parameters.get('ExceptionFormat') ?>
133      <Exception py:if="exceptions is not None">
134        <Format py:for="e in exceptions.possibleValues.allowedValues"
135                py:content="e"/>
136      </Exception>
137     <!--! <Layer py:replace="layer(sm.contents.datasetSummaries[0])"/> -->
138    </Capability>
139<!--***************************************-->
140  <!--*        ContentMetadata                *-->
141  <!--***************************************--> 
142  <Contents>
143        <CoverageSummary py:replace="coverageSummary(sm.contents.datasetSummaries[0])"/>
144  </Contents>
145</WCS_Capabilities>
Note: See TracBrowser for help on using the repository browser.