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

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

Basic support for WebMapContext? documents.

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