source: TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/wms_capabilities_1_1_1.xml @ 3569

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/wms_capabilities_1_1_1.xml@3569
Revision 3569, 5.1 KB checked in by spascoe, 11 years ago (diff)

Slight changing to caching code. tweeking capabilities to test
compatibility with mapClient.

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 genshi.builder import tag, Element
8from ows_common.pylons.genshi_util import RenameElementFilter
9from genshi import QName
10import webhelpers as h
11import sets
12
13?>
14
15<WMT_MS_Capabilities xmlns:py="http://genshi.edgewall.org/"
16                     version="1.1.1">
17
18  <!--! ====================================================================== -->
19  <!--!
20      To change the tag name we need to wrap a markup macro in a python
21      function
22  -->
23
24  <Operation py:def="_opContent(op)">
25    <Format py:for="f in op.parameters['Format'].possibleValues.allowedValues" py:content="f"/>
26    <DCPType><HTTP>
27      <Get>
28        <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" 
29                        xlink:href="${op.get.href}"/>
30      </Get>
31    </HTTP></DCPType>
32  </Operation>
33  <?python
34 
35  def markupOperation(opName, op):
36    """Render an OWS operation description for the Capabilities section.
37    """
38
39    return RenameElementFilter(QName(opName))(_opContent(op))
40
41  ?>
42
43  <Layer py:def="markupLayer(ds)">
44    <Name py:content="ds.identifier"/>
45    <Title py:content="ds.titles[0]"/>
46    <Abstract py:if="len(ds.abstracts)>0" py:content="ds.abstracts[0]"/>
47    <SRS py:for="crs in ds.CRSs" py:content="crs"/>
48    <py:for each="bb in ds.boundingBoxes">
49      <BoundingBox SRS="${bb.crs}"
50                   minx="${'%.2f'%bb.lowerCorner[0]}"
51                   miny="${'%.2f'%bb.lowerCorner[1]}"
52                   maxx="${'%.2f'%bb.upperCorner[0]}"
53                   maxy="${'%.2f'%bb.upperCorner[1]}"/>
54    </py:for>
55
56    <!-- TODO Attribution from metadata -->
57    <!-- TODO AuthorityURL from metadata -->
58    <!-- TODO FeatureListURL from metadata -->
59    <!-- TODO Identifier from metadata -->
60    <!-- TODO DataURL from metadata -->
61    <!-- TODO MetadataURL from metadata -->
62    <!-- TODO Style -->
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
72  </Layer>
73
74  <!--! ====================================================================== -->
75
76
77  <Service py:with="sm=c.capabilities; si=c.capabilities.serviceIdentification">
78    <Name>OGC:WMS</Name>
79    <Title py:content="si.titles[0]"/>
80    <Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
81    <KeywordList>
82      <Keyword py:for="kw in si.keywords"
83               py:content="kw"/>
84    </KeywordList>
85    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" 
86                    xlink:href="${h.url_for(qualified=True, action='index')}?"/>
87   
88    <ContactInformation py:if="sm.serviceProvider is not None"
89                        py:with="rp=sm.serviceProvider.serviceContact">
90      <ContactPersonPrimary>
91        <ContactPerson py:if="rp is not None" py:content="rp.individualName"/>
92        <ContactOrganization py:content="sm.serviceProvider.providerName"/>
93      </ContactPersonPrimary>
94      <ContactPosition py:content="rp.positionName"/>
95
96      <py:with vars="cn=rp.contactInfo" py:if="cn is not None">
97        <ContactAddress py:if="cn.address is not None">
98          <AddressType>postal</AddressType>
99          <Address>
100            <py:for each="d in cn.address.deliveryPoints">${d}</py:for>
101          </Address>
102          <City py:content="cn.address.city"/>
103          <StateOrProvince py:content="cn.address.administrativeArea"/>
104          <PostCode py:content="cn.address.postalCode"/>
105          <Country py:content="cn.address.country"/>
106        </ContactAddress>
107        <ContactVoiceTelephone py:if="cn.phone is not None"
108                               py:content="cn.phone.voice"/>
109        <ContactFacsimileTelephone py:if="cn.phone is not None"
110                                   py:content="cn.phone.facsimile"/>
111        <ContactElectronicMailAddress py:if="cn.address is not None"
112                                      py:content="cn.address.electronicMailAddress"/>
113      </py:with>
114    </ContactInformation>
115   
116    <Fees py:content="si.fees"/>
117    <AccessConstraints py:content="si.accessConstraints"/>
118  </Service>
119 
120  <!--! These fields are represented in ows_common as service constraints -->
121  <Capability py:with="sm=c.capabilities; om=sm.operationsMetadata">
122    <py:if test="om is not None">
123      <?python ops = ['GetCapabilities', 'GetMap', 'GetFeatureInfo'] ?>
124      <Request>
125        <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
126          <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/>
127        </py:for>
128        <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
129          <?python exceptions = om.operationDict[opName].parameters.get('ExceptionFormat') ?>
130          <Exception py:if="exceptions is not None">
131            <Format py:for="e in exceptions.possibleValues.allowedValues"
132                    py:content="e"/>
133          </Exception>
134        </py:for>
135      </Request>
136    </py:if>
137   
138    <!--!TODO:  capability exceptions -->
139    <Exception><Format>text/xml</Format></Exception>
140
141    <Layer py:if="sm.contents is not None">
142      <Title>Contents</Title>
143      <Layer py:for="ds in sm.contents.datasetSummaries"
144             py:replace="markupLayer(ds)">
145      </Layer>
146    </Layer>
147  </Capability>
148</WMT_MS_Capabilities>
Note: See TracBrowser for help on using the repository browser.