1 | <?xml version="1.0"?> |
---|
2 | |
---|
3 | <?python |
---|
4 | |
---|
5 | from cows.pylons.genshi_util import RenameElementFilter |
---|
6 | from genshi import QName |
---|
7 | import webhelpers as h |
---|
8 | |
---|
9 | ?> |
---|
10 | |
---|
11 | <WFS_Capabilities xmlns:py="http://genshi.edgewall.org/" |
---|
12 | xmlns="http://www.opengis.net/wfs" |
---|
13 | xmlns:xlink="http://www.w3.org/1999/xlink" |
---|
14 | xmlns:ows="http://www.opengis.net/ows" |
---|
15 | xmlns:gml="http://www.opengis.net/gml" version="1.3.0"> |
---|
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 xlink:type="simple" 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 | <FeatureType 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 | <CRS py:for="crs in ds.CRSs" py:content="crs"/> |
---|
46 | <?python exBBox = ds.wgs84BoundingBoxes[0]?> |
---|
47 | <ows:WGS84BoundingBox> |
---|
48 | <ows:LowerCorner py:content="str(exBBox.lowerCorner[0]) + ' ' + str(exBBox.lowerCorner[1])" /> |
---|
49 | <ows:UpperCorner py:content="str(exBBox.upperCorner[0]) + ' ' + str(exBBox.upperCorner[1])" /> |
---|
50 | </ows:WGS84BoundingBox> |
---|
51 | </FeatureType> |
---|
52 | <!--! ====================================================================== --> |
---|
53 | |
---|
54 | |
---|
55 | <ows:ServiceIdentification py:with="sm=c.capabilities; si=c.capabilities.serviceIdentification"> |
---|
56 | <ows:Name>BADC WFS</ows:Name> |
---|
57 | <ows:Title py:content="si.titles[0]"/> |
---|
58 | <ows:Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/> |
---|
59 | <ows:Keywords> |
---|
60 | <ows:Keyword py:for="kw in si.keywords" |
---|
61 | py:content="kw"/> |
---|
62 | </ows:Keywords> |
---|
63 | <!--! <OnlineResource xlink:type="simple" xlink:href="${h.url_for(qualified=True, action='index')}?"/> --> |
---|
64 | |
---|
65 | <ows:ServiceProvider py:if="sm.serviceProvider is not None" |
---|
66 | py:with="rp=sm.serviceProvider.serviceContact"> |
---|
67 | <ows:ProviderName py:content="sm.serviceProvider.providerName"/> |
---|
68 | <ows:ServiceContact> |
---|
69 | <ows:IndividualName py:if="rp is not None" py:content="rp.individualName"/> |
---|
70 | <ows:PositionName py:content="rp.positionName"/> |
---|
71 | <py:with vars="cn=rp.contactInfo" py:if="cn is not None"> |
---|
72 | <ows:ContactInfo py:if="cn.phone is not None"> |
---|
73 | <ows:Voice py:content="cn.phone.voice"/> |
---|
74 | <ows:Facsimile py:content="cn.phone.facsimile"/> |
---|
75 | </ows:ContactInfo> |
---|
76 | <ows:Address py:if="cn.address is not None"> |
---|
77 | <ows:DeliveryPoint><py:for each="d in cn.address.deliveryPoints">${d}</py:for> |
---|
78 | </ows:DeliveryPoint> |
---|
79 | <ows:City py:content="cn.address.city"/> |
---|
80 | <ows:AdministrativeArea py:content="cn.address.administrativeArea"/> |
---|
81 | <ows:PostalCode py:content="cn.address.postalCode"/> |
---|
82 | <ows:Country py:content="cn.address.country"/> |
---|
83 | <ows:ElectronicMailAddress py:content="cn.address.electronicMailAddress"/> |
---|
84 | </ows:Address> |
---|
85 | </py:with> |
---|
86 | </ows:ServiceContact> |
---|
87 | </ows:ServiceProvider> |
---|
88 | <ows:Fees py:content="si.fees"/> |
---|
89 | <ows:AccessConstraints py:content="si.accessConstraints"/> |
---|
90 | </ows:ServiceIdentification> |
---|
91 | <!--! These fields are represented in ows_common as service constraints --> |
---|
92 | |
---|
93 | <ows:OperationsMetadata py:with="sm=c.capabilities; om=sm.operationsMetadata"> |
---|
94 | <py:if test="om is not None"> |
---|
95 | <?python |
---|
96 | ops = ['GetCapabilities', 'DescribeFeature', 'GetFeature'] |
---|
97 | eops = [x for x in om.operationDict.keys() if x not in ops] |
---|
98 | ?> |
---|
99 | <ows:OperationsMetadata> |
---|
100 | <py:for each="opName in ops" py:if="opName in om.operationDict.keys()"> |
---|
101 | <ows:Operation name="${opName}"> |
---|
102 | <ows:DCP> |
---|
103 | <ows:HTTP> |
---|
104 | <ows:Get xlink:type="simple" xlink:href="${om.operationDict[opName].get.href}"/> |
---|
105 | </ows:HTTP> |
---|
106 | </ows:DCP> |
---|
107 | </ows:Operation> |
---|
108 | </py:for> |
---|
109 | </ows:OperationsMetadata> |
---|
110 | <_ExtendedCapabilities> |
---|
111 | <Request> |
---|
112 | <py:for each="opName in eops"> |
---|
113 | <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/> |
---|
114 | </py:for> |
---|
115 | <py:for each="opName in eops"> |
---|
116 | <?python exceptions = om.operationDict[opName].parameters.get('ExceptionFormat') ?> |
---|
117 | <Exception py:if="exceptions is not None"> |
---|
118 | <Format py:for="e in exceptions.possibleValues.allowedValues" |
---|
119 | py:content="e"/> |
---|
120 | </Exception> |
---|
121 | </py:for> |
---|
122 | </Request> |
---|
123 | </_ExtendedCapabilities> |
---|
124 | </py:if> |
---|
125 | </ows:OperationsMetadata> |
---|
126 | |
---|
127 | <FeatureTypeList py:if="c.capabilities.contents is not None"> |
---|
128 | <Title>Contents</Title> |
---|
129 | <FeatureType py:for="ds in c.capabilities.contents.datasetSummaries" |
---|
130 | py:replace="markupLayer(ds)"> |
---|
131 | </FeatureType> |
---|
132 | </FeatureTypeList> |
---|
133 | |
---|
134 | </WFS_Capabilities> |
---|