source: cows/branches/wcsmerge/cows/pylons/templates/wcs_capabilities_1_0_0.xml @ 4574

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/branches/wcsmerge/cows/pylons/templates/wcs_capabilities_1_0_0.xml@4574
Revision 4574, 5.7 KB checked in by domlowe, 12 years ago (diff)

First stage in merging - still in flux.

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 cows.pylons.genshi_util import RenameElementFilter
8from genshi import QName
9import webhelpers as h
10
11?>
12
13<!--! TODO: This currently looks like WMS, change to WCS based on old kid template -->
14
15<WCS_Capabilities xmlns:py="http://genshi.edgewall.org/"
16                     version="1.0.0">
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)" queryable="${int(ds.queryable)}">
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   
63    <!--!NOTE: this is an ad-hoc implementation not using the ows_common.model classes
64         TODO: fixme -->
65    <!-- TODO ScaleHint -->
66
67    <Dimension py:for="d_n, d in ds.dimensions.iteritems()"
68               name="${d_n}" units="${d.valuesUnit}"
69               unitSymbol="${d.unitSymbol}"/>
70    <Extent py:for="d_n, d in ds.dimensions.iteritems()" name="${d_n}" default="${d.defaultValue}" 
71            py:content="','.join(d.possibleValues.allowedValues)"/>
72<!--! nearestValue="${int(d.nearestValue)}" -->
73    <Style>
74      <Name>default</Name>
75      <Title>Default</Title>
76      <LegendURL width="${ds.legendSize[0]}" height="${ds.legendSize[1]}">
77        <Format py:for="f in ds.legendFormats" py:content="f"/>
78        <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" 
79                        xlink:href="${h.url_for(qualified=True, action='index')}?request=GetLegend&amp;layers=${ds.identifier}"/>
80      </LegendURL>
81    </Style>
82
83
84  </Layer>
85
86  <!--! ====================================================================== -->
87
88
89  <Service py:with="sm=c.capabilities; si=c.capabilities.serviceIdentification">
90    <Name>OGC:WMS</Name>
91    <Title py:content="si.titles[0]"/>
92    <Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/>
93    <KeywordList>
94      <Keyword py:for="kw in si.keywords"
95               py:content="kw"/>
96    </KeywordList>
97    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" 
98                    xlink:href="${h.url_for(qualified=True, action='index')}?"/>
99   
100    <ContactInformation py:if="sm.serviceProvider is not None"
101                        py:with="rp=sm.serviceProvider.serviceContact">
102      <ContactPersonPrimary>
103        <ContactPerson py:if="rp is not None" py:content="rp.individualName"/>
104        <ContactOrganization py:content="sm.serviceProvider.providerName"/>
105      </ContactPersonPrimary>
106      <ContactPosition py:content="rp.positionName"/>
107
108      <py:with vars="cn=rp.contactInfo" py:if="cn is not None">
109        <ContactAddress py:if="cn.address is not None">
110          <AddressType>postal</AddressType>
111          <Address>
112            <py:for each="d in cn.address.deliveryPoints">${d}</py:for>
113          </Address>
114          <City py:content="cn.address.city"/>
115          <StateOrProvince py:content="cn.address.administrativeArea"/>
116          <PostCode py:content="cn.address.postalCode"/>
117          <Country py:content="cn.address.country"/>
118        </ContactAddress>
119        <ContactVoiceTelephone py:if="cn.phone is not None"
120                               py:content="cn.phone.voice"/>
121        <ContactFacsimileTelephone py:if="cn.phone is not None"
122                                   py:content="cn.phone.facsimile"/>
123        <ContactElectronicMailAddress py:if="cn.address is not None"
124                                      py:content="cn.address.electronicMailAddress"/>
125      </py:with>
126    </ContactInformation>
127   
128    <Fees py:content="si.fees"/>
129    <AccessConstraints py:content="si.accessConstraints"/>
130  </Service>
131 
132  <!--! These fields are represented in ows_common as service constraints -->
133  <Capability py:with="sm=c.capabilities; om=sm.operationsMetadata">
134    <py:if test="om is not None">
135      <?python ops = ['GetCapabilities', 'GetMap', 'GetFeatureInfo'] ?>
136      <Request>
137        <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
138          <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/>
139        </py:for>
140        <py:for each="opName in ops" py:if="opName in om.operationDict.keys()">
141          <?python exceptions = om.operationDict[opName].parameters.get('ExceptionFormat') ?>
142          <Exception py:if="exceptions is not None">
143            <Format py:for="e in exceptions.possibleValues.allowedValues"
144                    py:content="e"/>
145          </Exception>
146        </py:for>
147      </Request>
148    </py:if>
149   
150    <!--!TODO:  capability exceptions -->
151    <Exception><Format>text/xml</Format></Exception>
152
153    <Layer py:if="sm.contents is not None">
154      <Title>Contents</Title>
155      <Layer py:for="ds in sm.contents.datasetSummaries"
156             py:replace="markupLayer(ds)">
157      </Layer>
158    </Layer>
159  </Capability>
160</WCS_Capabilities>
Note: See TracBrowser for help on using the repository browser.