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

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@3563
Revision 3563, 5.1 KB checked in by spascoe, 11 years ago (diff)

Accidently commited with a commented-out dimension description.

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}" nearestValue="${int(d.nearestValue)}"
69            py:content="','.join(d.possibleValues.allowedValues)"/>
70
71  </Layer>
72
73  <!--! ====================================================================== -->
74
75
76  <Service py:with="sm=c.capabilities; si=c.capabilities.serviceIdentification">
77    <Name>OGC:WMS</Name>
78    <Title py:content="si.titles[0]"/>
79    <Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
80    <KeywordList>
81      <Keyword py:for="kw in si.keywords"
82               py:content="kw"/>
83    </KeywordList>
84    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" 
85                    xlink:href="${h.url_for(qualified=True, action='index')}?"/>
86   
87    <ContactInformation py:if="sm.serviceProvider is not None"
88                        py:with="rp=sm.serviceProvider.serviceContact">
89      <ContactPersonPrimary>
90        <ContactPerson py:if="rp is not None" py:content="rp.individualName"/>
91        <ContactOrganization py:content="sm.serviceProvider.providerName"/>
92      </ContactPersonPrimary>
93      <ContactPosition py:content="rp.positionName"/>
94
95      <py:with vars="cn=rp.contactInfo" py:if="cn is not None">
96        <ContactAddress py:if="cn.address is not None">
97          <AddressType>postal</AddressType>
98          <Address>
99            <py:for each="d in cn.address.deliveryPoints">${d}</py:for>
100          </Address>
101          <City py:content="cn.address.city"/>
102          <StateOrProvince py:content="cn.address.administrativeArea"/>
103          <PostCode py:content="cn.address.postalCode"/>
104          <Country py:content="cn.address.country"/>
105        </ContactAddress>
106        <ContactVoiceTelephone py:if="cn.phone is not None"
107                               py:content="cn.phone.voice"/>
108        <ContactFacsimileTelephone py:if="cn.phone is not None"
109                                   py:content="cn.phone.facsimile"/>
110        <ContactElectronicMailAddress py:if="cn.address is not None"
111                                      py:content="cn.address.electronicMailAddress"/>
112      </py:with>
113    </ContactInformation>
114   
115    <Fees py:content="si.fees"/>
116    <AccessConstraints py:content="si.accessConstraints"/>
117  </Service>
118 
119  <!--! These fields are represented in ows_common as service constraints -->
120  <Capability py:with="sm=c.capabilities; om=sm.operationsMetadata">
121    <py:if test="om is not None">
122      <?python ops = ['GetCapabilities', 'GetMap', 'GetFeatureInfo'] ?>
123      <Request>
124        <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
125          <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/>
126        </py:for>
127        <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
128          <?python exceptions = om.operationDict[opName].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        </py:for>
134      </Request>
135    </py:if>
136   
137    <!--!TODO:  capability exceptions -->
138    <Exception><Format>text/xml</Format></Exception>
139
140    <Layer py:if="sm.contents is not None">
141      <Title>Contents</Title>
142      <Layer py:for="ds in sm.contents.datasetSummaries"
143             py:replace="markupLayer(ds)">
144      </Layer>
145    </Layer>
146  </Capability>
147</WMT_MS_Capabilities>
Note: See TracBrowser for help on using the repository browser.