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

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

changes to getCapabilites and mime handling

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  <Operation py:def="opXML(op)">
33    <?python formats = op.parameters.get('Format') ?>
34    <Format py:if="formats is not None"
35            py:for="f in formats.possibleValues.allowedValues"
36            py:content="f"/>
37    <DCPType>
38      <HTTP>
39        <Get py:if="op.get is not None">
40          <OnlineResource xlink:type="simple" xlink:href="${op.get.href}"/>
41        </Get>
42        <Post py:if="op.post is not None">
43          <OnlineResource xlink:type="simple" xlink:href="${op.post.href}"/>
44        </Post>
45      </HTTP>
46    </DCPType>
47  </Operation>
48
49
50
51  <CoverageSummary py:def="coverageSummary(ds)">
52    <!--!  coverageSummary comes from wmsDatasetSummary  TODO   -->
53    <Identifier py:if="ds.identifier is not None" py:content="ds.identifier"/>
54    <Description py:if="ds.description is not None" py:content="ds.description"/>
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:Metadata></ows:Metadata>
58    <ows:WGS84BoundingBox></ows:WGS84BoundingBox>
59    <CoverageSummary py:for="ds1 in ds.datasetSummaries" py:replace="coverageSummary(ds1)"/>
60  </CoverageSummary>
61
62
63
64
65
66  <!--! Main body -->
67  <?python
68  sm = c.service_metadata
69  si = c.service_metadata.serviceIdentification   
70  ?>
71  <Service>
72    <Name>WCS</Name>
73    <Title py:content="si.titles[0]"/>
74    <Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
75    <KeywordList>
76      <Keyword py:for="kw in si.keywords"
77               py:content="kw"/>
78    </KeywordList>
79    <!--! <OnlineResource xlink:type="simple" xlink:href="${h.url_for()}"/> -->
80    <ContactInformation py:if="sm.serviceProvider is not None">
81      <?python rp = sm.serviceProvider.serviceContact ?>
82      <ContactPersonPrimary>
83        <ContactPerson py:if="rp is not None" py:content="rp.individualName"/>
84        <ContactOrganisation py:content="sm.serviceProvider.providerName"/>
85      </ContactPersonPrimary>
86      <ContactPosition py:content="rp.positionName"/>
87     
88      <?python cn = rp.contactInfo ?>
89      <div py:if="cn is not None" py:strip="1">
90        <ContactAddress py:if="cn.address is not None">
91          <AddressType>postal</AddressType>
92          <Address>
93            <span py:for="d in cn.address.deliveryPoints" py:replace="d"/>
94          </Address>
95          <City py:content="cn.address.city"/>
96          <StateOrProvince py:content="cn.address.administrativeArea"/>
97          <PostCode py:content="cn.address.postalCode"/>
98          <Country py:content="cn.address.country"/>
99        </ContactAddress>
100        <ContactVoiceTelephone py:if="cn.phone is not None"
101                               py:content="cn.phone.voice"/>
102        <ContactFacsimileTelephone py:if="cn.phone is not None"
103                                   py:content="cn.phone.facsimile"/>
104        <ContactElectronicMailAddress py:if="cn.address is not None"
105                                      py:content="cn.address.electronicMailAddress"/>
106      </div>
107    </ContactInformation>
108    <Fees py:content="si.fees"/>
109    <AccessConstraints py:content="si.accessConstraints"/>
110    <!--! These fields are represented in ows_common as service constraints -->
111    <?python om = sm.operationsMetadata ?>
112    <LayerLimit py:if="'LayerLimit' in om.constraints"
113                py:content="om.constraints['LayerLimit'].possibleValues.allowedValues[0]"/>
114    <MaxWidth py:if="'MaximumWidth' in om.constraints"
115              py:content="om.constraints['MaximumWidth'].possibleValues.allowedValues[0]"/>
116    <MinWidth py:if="'MinimumWidth' in om.constraints"
117              py:content="om.constraints['MinimumWidth'].possibleValues.allowedValues[0]"/>
118    <Capability>
119      <Request>
120        <ops py:for="opName, op in om.operationDict.items()"
121             py:content="operation(opName, op)"
122             py:strip="1"/>
123      </Request>
124      <?python exceptions = op.parameters.get('ExceptionFormat') ?>
125      <Exception py:if="exceptions is not None">
126        <Format py:for="e in exceptions.possibleValues.allowedValues"
127                py:content="e"/>
128      </Exception>
129     <!--! <Layer py:replace="layer(sm.contents.datasetSummaries[0])"/> -->
130    </Capability>
131  </Service>
132  <Content>
133        <CoverageSummary py:replace="coverageSummary(sm.contents.datasetSummaries[0])"/>
134  </Content>
135</Capabilities>
Note: See TracBrowser for help on using the repository browser.