source: cows/branches/cows_qesdi/cows/pylons/templates/wms_capabilities_1_3_0.xml @ 5493

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/branches/cows_qesdi/cows/pylons/templates/wms_capabilities_1_3_0.xml@5493
Revision 5493, 7.7 KB checked in by pnorton, 12 years ago (diff)

Implemented the changes made while working on the qesdi wms. Also changed the csmlbackend wms so that it works with the new WMSContoller.

Line 
1<?xml version="1.0"?>
2
3<?python
4
5from cows.pylons.genshi_util import RenameElementFilter
6from genshi import QName
7from routes import url_for
8
9?>
10
11<WMS_Capabilities xmlns:py="http://genshi.edgewall.org/"
12          xmlns="http://www.opengis.net/wms"
13          xmlns:xlink="http://www.w3.org/1999/xlink"
14          version="1.3.0">
15
16  <!--! ====================================================================== -->
17  <!--!
18      To change the tag name we need to wrap a markup macro in a python
19      function
20  -->
21
22  <Operation py:def="_opContent(op)">
23    <Format py:for="f in op.parameters['Format'].possibleValues.allowedValues" py:content="f"/>
24    <DCPType><HTTP>
25      <Get>
26    <OnlineResource xlink:type="simple" xlink:href="${op.get.href}"/>
27      </Get>
28    </HTTP></DCPType>
29  </Operation>
30  <?python
31 
32  def markupOperation(opName, op):
33    """Render an OWS operation description for the Capabilities section.
34    """
35
36    return RenameElementFilter(QName(opName))(_opContent(op))
37
38  ?>
39
40
41    <py:def function="markupLegendURL(l)">
42      <LegendURL width="${l.width}" height="${l.height}">
43         <Format>${l.format}</Format>
44         <OnlineResource xlink:type="simple" xlink:href="${l.onlineResource.href}"/>
45      </LegendURL>
46    </py:def>
47
48
49    <py:def function="markupStyle(s)">
50      <Style>
51        <Name>${s.name}</Name>
52        <Title>${s.title}</Title>
53        <py:for each="l in s.legendURLs" py:if="getattr(s, 'legendURLs', None) != None">
54          ${markupLegendURL(l)}
55        </py:for>
56      </Style>
57    </py:def>
58
59  <Layer py:def="markupLayer(ds)" queryable="${int(ds.queryable)}">
60    <Name py:content="ds.identifier"/>
61    <Title py:content="ds.titles[0]"/>
62    <Abstract py:if="len(ds.abstracts)>0" py:content="ds.abstracts[0]"/>
63    <CRS py:for="crs in ds.CRSs" py:content="crs"/>
64    <?python exBBox = ds.wgs84BoundingBoxes[0] ?>
65    <EX_GeographicBoundingBox>
66      <westBoundLongitude py:content="exBBox.lowerCorner[0]"/>
67      <eastBoundLongitude py:content="exBBox.upperCorner[0]"/>
68      <southBoundLatitude py:content="exBBox.lowerCorner[1]"/>
69      <northBoundLatitude py:content="exBBox.upperCorner[1]"/>
70    </EX_GeographicBoundingBox>
71
72    <py:for each="bb in ds.boundingBoxes">
73      <BoundingBox CRS="${bb.crs}"
74           minx="${'%.2f'%bb.lowerCorner[0]}"
75           miny="${'%.2f'%bb.lowerCorner[1]}"
76           maxx="${'%.2f'%bb.upperCorner[0]}"
77           maxy="${'%.2f'%bb.upperCorner[1]}"/>
78    </py:for>
79
80    <!--!TODO Attribution from metadata -->
81    <!--!TODO AuthorityURL from metadata -->
82    <!--!TODO FeatureListURL from metadata -->
83    <!--!TODO Identifier from metadata -->
84    <!--!TODO DataURL from metadata -->
85    <!--!TODO MetadataURL from metadata -->
86   
87    <!--!NOTE: this is an ad-hoc implementation not using the ows_common.model classes
88         TODO: fixme -->
89    <!-- TODO ScaleHint -->
90
91    <Dimension py:for="d_n, d in ds.dimensions.iteritems()"
92           name="${d_n}" units="${d.valuesUnit}"
93           unitSymbol="${d.unitSymbol}"
94           default="${d.defaultValue}" 
95           py:content="','.join(d.possibleValues.allowedValues)"/>
96<!--! nearestValue="${int(d.nearestValue)}" -->
97
98   
99   
100    <py:choose test="ds.styles">
101
102        <py:when test="['']">
103            <Style>
104                <Name>default</Name>
105                <Title>Default</Title>
106                <LegendURL width="${ds.legendSize[0]}" height="${ds.legendSize[1]}">
107                    <Format py:for="f in ds.legendFormats" py:content="f"/>
108                    <OnlineResource xlink:type="simple" xlink:href="${url_for(qualified=True, action='index')}?request=GetLegend&amp;layers=${ds.identifier}"/>
109                </LegendURL>
110            </Style>
111        </py:when>
112
113        <py:otherwise>
114            <py:for each="s in ds.styles" py:if="getattr(ds, 'styles', None) != None">
115                ${markupStyle(s)}
116            </py:for>
117        </py:otherwise>
118
119    </py:choose>
120
121
122  </Layer>
123
124  <!--! ====================================================================== -->
125
126
127  <Service py:with="sm=c.capabilities; si=c.capabilities.serviceIdentification">
128    <Name>WMS</Name>
129    <Title py:content="si.titles[0]"/>
130    <Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
131    <KeywordList>
132      <Keyword py:for="kw in si.keywords"
133           py:content="kw"/>
134    </KeywordList>
135    <OnlineResource xlink:type="simple" xlink:href="${url_for(qualified=True, action='index')}?"/>
136   
137    <ContactInformation py:if="sm.serviceProvider is not None"
138            py:with="rp=sm.serviceProvider.serviceContact">
139      <ContactPersonPrimary>
140    <ContactPerson py:if="rp is not None" py:content="rp.individualName"/>
141    <ContactOrganization py:content="sm.serviceProvider.providerName"/>
142      </ContactPersonPrimary>
143      <ContactPosition py:content="rp.positionName"/>
144
145      <py:with vars="cn=rp.contactInfo" py:if="rp.contactInfo is not None">
146    <ContactAddress py:if="cn.address is not None">
147      <AddressType>postal</AddressType>
148      <Address>
149        <py:for each="d in cn.address.deliveryPoints">${d}</py:for>
150      </Address>
151      <City py:content="cn.address.city"/>
152      <StateOrProvince py:content="cn.address.administrativeArea"/>
153      <PostCode py:content="cn.address.postalCode"/>
154      <Country py:content="cn.address.country"/>
155    </ContactAddress>
156    <ContactVoiceTelephone py:if="cn.phone is not None"
157                   py:content="cn.phone.voice"/>
158    <ContactFacsimileTelephone py:if="cn.phone is not None"
159                   py:content="cn.phone.facsimile"/>
160    <ContactElectronicMailAddress py:if="cn.address is not None"
161                      py:content="cn.address.electronicMailAddress"/>
162      </py:with>
163    </ContactInformation>
164   
165    <Fees py:content="si.fees"/>
166    <AccessConstraints py:content="si.accessConstraints"/>
167
168    <!--!TODO: These are hardcoded for Jon Blower's WMS->KML service.  Make generic.-->
169    <LayerLimit>1</LayerLimit>
170    <MaxWidth>640</MaxWidth>
171    <MaxHeight>640</MaxHeight>
172
173  </Service>
174  <!--! These fields are represented in ows_common as service constraints -->
175  <Capability py:with="sm=c.capabilities; om=sm.operationsMetadata">
176    <py:if test="om is not None">
177      <?python
178    ops = ['GetCapabilities', 'GetMap', 'GetFeatureInfo']
179    eops = [x for x in om.operationDict.keys() if x not in ops]
180      ?>
181      <Request>
182    <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
183      <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/>
184    </py:for>
185    <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
186      <?python exceptions = om.operationDict[opName].parameters.get('ExceptionFormat') ?>
187      <Exception py:if="exceptions is not None">
188        <Format py:for="e in exceptions.possibleValues.allowedValues"
189            py:content="e"/>
190      </Exception>
191    </py:for>
192      </Request>
193
194      <!--!TODO:  capability exceptions -->
195      <Exception><Format>text/xml</Format></Exception>     
196     
197      <_ExtendedCapabilities>
198      <Request>
199    <py:for each="opName in eops">
200      <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/>
201    </py:for>
202    <py:for each="opName in eops">
203      <?python exceptions = om.operationDict[opName].parameters.get('ExceptionFormat') ?>
204      <Exception py:if="exceptions is not None">
205        <Format py:for="e in exceptions.possibleValues.allowedValues"
206            py:content="e"/>
207      </Exception>
208    </py:for>
209      </Request>
210      </_ExtendedCapabilities>
211    </py:if>
212   
213    <Layer py:if="sm.contents is not None">
214      <Title>Contents</Title>
215      <Layer py:for="ds in sm.contents.datasetSummaries"
216         py:replace="markupLayer(ds)">
217      </Layer>
218    </Layer>
219  </Capability>
220</WMS_Capabilities>
Note: See TracBrowser for help on using the repository browser.