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

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

changes to enable SupportedFormats? and SupportedCRS parameters

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  <owcs:ServiceIdentification>
82    <ows:Name>WCS</ows:Name>
83    <ows:Title py:content="si.titles[0]"/>
84    <ows:Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
85    <ows:Keywords>
86      <ows:Keyword py:for="kw in si.keywords"
87               py:content="kw"/>
88    </ows:Keywords>
89    <owcs:ServiceType>OCG WCS</owcs:ServiceType>
90    <owcs:ServiceTypeVersion>1.1.0</owcs:ServiceTypeVersion>
91    <owcs:Fees py:content="si.fees"/>
92    <owcs:AccessConstraints py:content="si.fees"/>
93    <AccessConstraints py:content="si.accessConstraints"/>
94   </owcs:ServiceIdentification>
95
96    <ows:ServiceProvider py:if="sm.serviceProvider is not None">
97      <?python rp = sm.serviceProvider.serviceContact ?>
98      <ows:ProviderName py:content="sm.serviceProvider.providerName"/>     
99      <ows:ServiceContact>
100        <ows:IndividualName py:if="rp is not None" py:content="rp.individualName"/>
101        <ows:PositionName py:content="rp.positionName"/>     
102        <?python cn = rp.contactInfo ?>
103        <div py:if="cn is not None" py:strip="1">
104            <ows:ContactInfo>   
105                <ows:Phone>
106                    <ows:Voice py:if="cn.phone is not None"
107                                py:content="cn.phone.voice"/>
108                    <ows:Facsimile py:if="cn.phone is not None"
109                                    py:content="cn.phone.facsimile"/>
110                </ows:Phone>                       
111                <ows:Address py:if="cn.address is not None">
112                    <ows:DeliveryPoint>                 
113                    <span py:for="d in cn.address.deliveryPoints" py:replace="d"/>
114                    </ows:DeliveryPoint>
115                    <ows:City py:content="cn.address.city"/>
116                    <ows:AdministrativeArea py:content="cn.address.administrativeArea"/>
117                    <ows:PostalCode py:content="cn.address.postalCode"/>
118                    <ows:Country py:content="cn.address.country"/>                                   
119                    <ows:ElectronicMailAddress py:if="cn.address is not None"
120                                        py:content="cn.address.electronicMailAddress"/>
121                </ows:Address>               
122          </ows:ContactInfo>           
123        </div>     
124      </ows:ServiceContact>
125     
126     
127     
128    </ows:ServiceProvider>
129    <!--! These fields are represented in ows_common as service constraints -->
130    <?python om = sm.operationsMetadata ?>
131    <LayerLimit py:if="'LayerLimit' in om.constraints"
132                py:content="om.constraints['LayerLimit'].possibleValues.allowedValues[0]"/>
133    <MaxWidth py:if="'MaximumWidth' in om.constraints"
134              py:content="om.constraints['MaximumWidth'].possibleValues.allowedValues[0]"/>
135    <MinWidth py:if="'MinimumWidth' in om.constraints"
136              py:content="om.constraints['MinimumWidth'].possibleValues.allowedValues[0]"/>
137
138
139    <owcs:OperationsMetadata>
140        <ops py:for="opName, op in om.operationDict.items()"
141             py:content="operation(opName, op)"
142             py:strip="1"/>
143      <?python exceptions = op.parameters.get('ExceptionFormat') ?>
144      <Exception py:if="exceptions is not None">
145        <Format py:for="e in exceptions.possibleValues.allowedValues"
146                py:content="e"/>
147      </Exception>
148     <!--! <Layer py:replace="layer(sm.contents.datasetSummaries[0])"/> -->
149    </owcs:OperationsMetadata>
150 
151  <Contents>
152        <CoverageSummary py:replace="coverageSummary(sm.contents.datasetSummaries[0])"/>
153  </Contents>
154</Capabilities>
Note: See TracBrowser for help on using the repository browser.