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

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

Several bugs that were making the Capabilities document invalid.

The DDP test WMS server is now viewable through Cadcorp's Map Browser.

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