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

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@3548
Revision 3548, 5.0 KB checked in by spascoe, 12 years ago (diff)

Added a simple data interface for WMS. This may not live in ows_common
in the long term but is the most convenient place to put it for now.

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