source: cows/trunk/cows/pylons/templates/wms_capabilities_1_1_1.xml @ 4032

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/trunk/cows/pylons/templates/wms_capabilities_1_1_1.xml@4032
Revision 4032, 5.6 KB checked in by spascoe, 11 years ago (diff)

Missing import changes.

Line 
1<?xml version="1.0"?>
2<!DOCTYPE WMT_MS_Capabilities SYSTEM
3 "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd">
4
5<?python
6
7from cows.pylons.genshi_util import RenameElementFilter
8from genshi import QName
9import webhelpers as h
10
11?>
12
13<WMT_MS_Capabilities xmlns:py="http://genshi.edgewall.org/"
14                     version="1.1.1">
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 xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" 
27                        xlink:href="${op.get.href}"/>
28      </Get>
29    </HTTP></DCPType>
30  </Operation>
31  <?python
32 
33  def markupOperation(opName, op):
34    """Render an OWS operation description for the Capabilities section.
35    """
36
37    return RenameElementFilter(QName(opName))(_opContent(op))
38
39  ?>
40
41  <Layer py:def="markupLayer(ds)" queryable="${int(ds.queryable)}">
42    <Name py:content="ds.identifier"/>
43    <Title py:content="ds.titles[0]"/>
44    <Abstract py:if="len(ds.abstracts)>0" py:content="ds.abstracts[0]"/>
45    <SRS py:for="crs in ds.CRSs" py:content="crs"/>
46    <py:for each="bb in ds.boundingBoxes">
47      <BoundingBox SRS="${bb.crs}"
48                   minx="${'%.2f'%bb.lowerCorner[0]}"
49                   miny="${'%.2f'%bb.lowerCorner[1]}"
50                   maxx="${'%.2f'%bb.upperCorner[0]}"
51                   maxy="${'%.2f'%bb.upperCorner[1]}"/>
52    </py:for>
53
54    <!-- TODO Attribution from metadata -->
55    <!-- TODO AuthorityURL from metadata -->
56    <!-- TODO FeatureListURL from metadata -->
57    <!-- TODO Identifier from metadata -->
58    <!-- TODO DataURL from metadata -->
59    <!-- TODO MetadataURL from metadata -->
60   
61    <!--!NOTE: this is an ad-hoc implementation not using the ows_common.model classes
62         TODO: fixme -->
63    <!-- TODO ScaleHint -->
64
65    <Dimension py:for="d_n, d in ds.dimensions.iteritems()"
66               name="${d_n}" units="${d.valuesUnit}"
67               unitSymbol="${d.unitSymbol}"/>
68    <Extent py:for="d_n, d in ds.dimensions.iteritems()" name="${d_n}" default="${d.defaultValue}" 
69            py:content="','.join(d.possibleValues.allowedValues)"/>
70<!--! nearestValue="${int(d.nearestValue)}" -->
71    <Style>
72      <Name>default</Name>
73      <Title>Default</Title>
74      <LegendURL width="${ds.legendSize[0]}" height="${ds.legendSize[1]}">
75        <Format py:for="f in ds.legendFormats" py:content="f"/>
76        <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" 
77                        xlink:href="${h.url_for(qualified=True, action='index')}?request=GetLegend&amp;layers=${ds.identifier}"/>
78      </LegendURL>
79    </Style>
80
81
82  </Layer>
83
84  <!--! ====================================================================== -->
85
86
87  <Service py:with="sm=c.capabilities; si=c.capabilities.serviceIdentification">
88    <Name>OGC:WMS</Name>
89    <Title py:content="si.titles[0]"/>
90    <Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
91    <KeywordList>
92      <Keyword py:for="kw in si.keywords"
93               py:content="kw"/>
94    </KeywordList>
95    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" 
96                    xlink:href="${h.url_for(qualified=True, action='index')}?"/>
97   
98    <ContactInformation py:if="sm.serviceProvider is not None"
99                        py:with="rp=sm.serviceProvider.serviceContact">
100      <ContactPersonPrimary>
101        <ContactPerson py:if="rp is not None" py:content="rp.individualName"/>
102        <ContactOrganization py:content="sm.serviceProvider.providerName"/>
103      </ContactPersonPrimary>
104      <ContactPosition py:content="rp.positionName"/>
105
106      <py:with vars="cn=rp.contactInfo" py:if="cn is not None">
107        <ContactAddress py:if="cn.address is not None">
108          <AddressType>postal</AddressType>
109          <Address>
110            <py:for each="d in cn.address.deliveryPoints">${d}</py:for>
111          </Address>
112          <City py:content="cn.address.city"/>
113          <StateOrProvince py:content="cn.address.administrativeArea"/>
114          <PostCode py:content="cn.address.postalCode"/>
115          <Country py:content="cn.address.country"/>
116        </ContactAddress>
117        <ContactVoiceTelephone py:if="cn.phone is not None"
118                               py:content="cn.phone.voice"/>
119        <ContactFacsimileTelephone py:if="cn.phone is not None"
120                                   py:content="cn.phone.facsimile"/>
121        <ContactElectronicMailAddress py:if="cn.address is not None"
122                                      py:content="cn.address.electronicMailAddress"/>
123      </py:with>
124    </ContactInformation>
125   
126    <Fees py:content="si.fees"/>
127    <AccessConstraints py:content="si.accessConstraints"/>
128  </Service>
129 
130  <!--! These fields are represented in ows_common as service constraints -->
131  <Capability py:with="sm=c.capabilities; om=sm.operationsMetadata">
132    <py:if test="om is not None">
133      <?python ops = ['GetCapabilities', 'GetMap', 'GetFeatureInfo'] ?>
134      <Request>
135        <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
136          <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/>
137        </py:for>
138        <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
139          <?python exceptions = om.operationDict[opName].parameters.get('ExceptionFormat') ?>
140          <Exception py:if="exceptions is not None">
141            <Format py:for="e in exceptions.possibleValues.allowedValues"
142                    py:content="e"/>
143          </Exception>
144        </py:for>
145      </Request>
146    </py:if>
147   
148    <!--!TODO:  capability exceptions -->
149    <Exception><Format>text/xml</Format></Exception>
150
151    <Layer py:if="sm.contents is not None">
152      <Title>Contents</Title>
153      <Layer py:for="ds in sm.contents.datasetSummaries"
154             py:replace="markupLayer(ds)">
155      </Layer>
156    </Layer>
157  </Capability>
158</WMT_MS_Capabilities>
Note: See TracBrowser for help on using the repository browser.