1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <?python |
---|
3 | """ |
---|
4 | Implements WCS capabilities v1.1.0 based on the ows_common model. |
---|
5 | |
---|
6 | Assumes ows_common.ServiceMetadata() object at c.service_metadata. |
---|
7 | |
---|
8 | """ |
---|
9 | |
---|
10 | def 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 | |
---|
19 | def 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 py:for="bb in ds.boundingBoxes" |
---|
59 | minx="${bb.lowerCorner[0]}" |
---|
60 | miny="${bb.lowerCorner[1]}" |
---|
61 | maxx="${bb.upperCorner[0]}" |
---|
62 | maxy="${bb.upperCorner[1]}"/> |
---|
63 | <CoverageSummary py:for="ds1 in ds.datasetSummaries" py:replace="coverageSummary(ds1)"/> |
---|
64 | </CoverageSummary> |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | |
---|
70 | <!--! Main body --> |
---|
71 | <?python |
---|
72 | sm = c.service_metadata |
---|
73 | si = c.service_metadata.serviceIdentification |
---|
74 | ?> |
---|
75 | <Service> |
---|
76 | <Name>WCS</Name> |
---|
77 | <Title py:content="si.titles[0]"/> |
---|
78 | <Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/> |
---|
79 | <KeywordList> |
---|
80 | <Keyword py:for="kw in si.keywords" |
---|
81 | py:content="kw"/> |
---|
82 | </KeywordList> |
---|
83 | <!--! <OnlineResource xlink:type="simple" xlink:href="${h.url_for()}"/> --> |
---|
84 | <ContactInformation py:if="sm.serviceProvider is not None"> |
---|
85 | <?python rp = sm.serviceProvider.serviceContact ?> |
---|
86 | <ContactPersonPrimary> |
---|
87 | <ContactPerson py:if="rp is not None" py:content="rp.individualName"/> |
---|
88 | <ContactOrganisation py:content="sm.serviceProvider.providerName"/> |
---|
89 | </ContactPersonPrimary> |
---|
90 | <ContactPosition py:content="rp.positionName"/> |
---|
91 | |
---|
92 | <?python cn = rp.contactInfo ?> |
---|
93 | <div py:if="cn is not None" py:strip="1"> |
---|
94 | <ContactAddress py:if="cn.address is not None"> |
---|
95 | <AddressType>postal</AddressType> |
---|
96 | <Address> |
---|
97 | <span py:for="d in cn.address.deliveryPoints" py:replace="d"/> |
---|
98 | </Address> |
---|
99 | <City py:content="cn.address.city"/> |
---|
100 | <StateOrProvince py:content="cn.address.administrativeArea"/> |
---|
101 | <PostCode py:content="cn.address.postalCode"/> |
---|
102 | <Country py:content="cn.address.country"/> |
---|
103 | </ContactAddress> |
---|
104 | <ContactVoiceTelephone py:if="cn.phone is not None" |
---|
105 | py:content="cn.phone.voice"/> |
---|
106 | <ContactFacsimileTelephone py:if="cn.phone is not None" |
---|
107 | py:content="cn.phone.facsimile"/> |
---|
108 | <ContactElectronicMailAddress py:if="cn.address is not None" |
---|
109 | py:content="cn.address.electronicMailAddress"/> |
---|
110 | </div> |
---|
111 | </ContactInformation> |
---|
112 | <Fees py:content="si.fees"/> |
---|
113 | <AccessConstraints py:content="si.accessConstraints"/> |
---|
114 | <!--! These fields are represented in ows_common as service constraints --> |
---|
115 | <?python om = sm.operationsMetadata ?> |
---|
116 | <LayerLimit py:if="'LayerLimit' in om.constraints" |
---|
117 | py:content="om.constraints['LayerLimit'].possibleValues.allowedValues[0]"/> |
---|
118 | <MaxWidth py:if="'MaximumWidth' in om.constraints" |
---|
119 | py:content="om.constraints['MaximumWidth'].possibleValues.allowedValues[0]"/> |
---|
120 | <MinWidth py:if="'MinimumWidth' in om.constraints" |
---|
121 | py:content="om.constraints['MinimumWidth'].possibleValues.allowedValues[0]"/> |
---|
122 | <Capability> |
---|
123 | <Request> |
---|
124 | <ops py:for="opName, op in om.operationDict.items()" |
---|
125 | py:content="operation(opName, op)" |
---|
126 | py:strip="1"/> |
---|
127 | </Request> |
---|
128 | <?python exceptions = op.parameters.get('ExceptionFormat') ?> |
---|
129 | <Exception py:if="exceptions is not None"> |
---|
130 | <Format py:for="e in exceptions.possibleValues.allowedValues" |
---|
131 | py:content="e"/> |
---|
132 | </Exception> |
---|
133 | <!--! <Layer py:replace="layer(sm.contents.datasetSummaries[0])"/> --> |
---|
134 | </Capability> |
---|
135 | </Service> |
---|
136 | <Content> |
---|
137 | <CoverageSummary py:replace="coverageSummary(sm.contents.datasetSummaries[0])"/> |
---|
138 | </Content> |
---|
139 | </Capabilities> |
---|