1 | <?xml version="1.0"?> |
---|
2 | |
---|
3 | <?python |
---|
4 | |
---|
5 | from cows.pylons.genshi_util import RenameElementFilter |
---|
6 | from genshi import QName |
---|
7 | from routes import url_for |
---|
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" |
---|
16 | xmlns:ogc="http://www.opengis.net/ogc" |
---|
17 | xmlns:csml="http://ndg.nerc.ac.uk/csml" version="1.1.0"> |
---|
18 | <!--! TODO: declare csml namespace on the fly --> |
---|
19 | |
---|
20 | <!--! ====================================================================== --> |
---|
21 | <!--! |
---|
22 | To change the tag name we need to wrap a markup macro in a python |
---|
23 | function |
---|
24 | --> |
---|
25 | |
---|
26 | <Operation py:def="_opContent(op)"> |
---|
27 | <Format py:for="f in op.parameters['Format'].possibleValues.allowedValues" py:content="f"/> |
---|
28 | <DCPType><HTTP> |
---|
29 | <Get> |
---|
30 | <OnlineResource xlink:type="simple" xlink:href="${op.get.href}"/> |
---|
31 | </Get> |
---|
32 | </HTTP></DCPType> |
---|
33 | </Operation> |
---|
34 | <?python |
---|
35 | |
---|
36 | def markupOperation(opName, op): |
---|
37 | """Render an OWS operation description for the Capabilities section. |
---|
38 | """ |
---|
39 | |
---|
40 | return RenameElementFilter(QName(opName))(_opContent(op)) |
---|
41 | |
---|
42 | ?> |
---|
43 | |
---|
44 | <FeatureType py:def="markupLayer(ds)"> |
---|
45 | <Name py:content="ds.identifier"/> |
---|
46 | <Title py:content="ds.titles[0]"/> |
---|
47 | <Abstract py:if="len(ds.abstracts)>0" py:content="ds.abstracts[0]"/> |
---|
48 | <ows:Keywords> |
---|
49 | <ows:Keyword py:for="kw in ds.keywords" py:content="kw"/> |
---|
50 | </ows:Keywords> |
---|
51 | <DefaultSRS>WGS:84</DefaultSRS> |
---|
52 | <OutputFormats> |
---|
53 | <Format py:for="format in ds.outputformats" py:content="format"/> |
---|
54 | </OutputFormats> |
---|
55 | <?python exBBox = ds.wgs84BoundingBoxes[0]?> |
---|
56 | <ows:WGS84BoundingBox> |
---|
57 | <ows:LowerCorner py:content="str(exBBox.lowerCorner[0]) + ' ' + str(exBBox.lowerCorner[1])" /> |
---|
58 | <ows:UpperCorner py:content="str(exBBox.upperCorner[0]) + ' ' + str(exBBox.upperCorner[1])" /> |
---|
59 | </ows:WGS84BoundingBox> |
---|
60 | </FeatureType> |
---|
61 | <!--! ====================================================================== --> |
---|
62 | |
---|
63 | |
---|
64 | <ows:ServiceIdentification py:with="sm=c.capabilities; si=c.capabilities.serviceIdentification"> |
---|
65 | <ows:Title py:content="si.titles[0]"/> |
---|
66 | <ows:Abstract py:if="len(si.abstracts)>0" py:content="si.abstracts[0]"/> |
---|
67 | <ows:Keywords py:if="len(si.keywords)>0"> |
---|
68 | <ows:Keyword py:for="kw in si.keywords" |
---|
69 | py:content="kw"/> |
---|
70 | </ows:Keywords> |
---|
71 | <!--! <OnlineResource xlink:type="simple" xlink:href="${url_for(qualified=True, action='index')}?"/> --> |
---|
72 | <ows:ServiceType>OGC:WFS</ows:ServiceType> |
---|
73 | <ows:ServiceTypeVersion>1.1.0</ows:ServiceTypeVersion> |
---|
74 | <ows:Fees py:content="si.fees"/> |
---|
75 | <ows:AccessConstraints py:content="si.accessConstraints"/> |
---|
76 | </ows:ServiceIdentification> |
---|
77 | <ows:ServiceProvider py:with="sm=c.capabilities; rp=sm.serviceProvider.serviceContact"> |
---|
78 | <ows:ProviderName py:content="sm.serviceProvider.providerName"/> |
---|
79 | <ows:ServiceContact> |
---|
80 | <ows:IndividualName py:if="rp is not None" py:content="rp.individualName"/> |
---|
81 | <ows:PositionName py:content="rp.positionName"/> |
---|
82 | <py:with vars="cn=rp.contactInfo" py:if="cn is not None"> |
---|
83 | <ows:ContactInfo py:if="cn.phone is not None"> |
---|
84 | <ows:Phone> |
---|
85 | <ows:Voice py:content="cn.phone.voice"/> |
---|
86 | <ows:Facsimile py:content="cn.phone.facsimile"/> |
---|
87 | </ows:Phone> |
---|
88 | <ows:Address py:if="cn.address is not None"> |
---|
89 | <ows:DeliveryPoint><py:for each="d in cn.address.deliveryPoints">${d}</py:for> |
---|
90 | </ows:DeliveryPoint> |
---|
91 | <ows:City py:content="cn.address.city"/> |
---|
92 | <ows:AdministrativeArea py:content="cn.address.administrativeArea"/> |
---|
93 | <ows:PostalCode py:content="cn.address.postalCode"/> |
---|
94 | <ows:Country py:content="cn.address.country"/> |
---|
95 | <ows:ElectronicMailAddress py:content="cn.address.electronicMailAddress"/> |
---|
96 | </ows:Address> |
---|
97 | </ows:ContactInfo> |
---|
98 | </py:with> |
---|
99 | </ows:ServiceContact> |
---|
100 | </ows:ServiceProvider> |
---|
101 | |
---|
102 | <!--! These fields are represented in ows_common as service constraints --> |
---|
103 | |
---|
104 | <ows:OperationsMetadata py:with="sm=c.capabilities; om=sm.operationsMetadata"> |
---|
105 | <py:if test="om is not None"> |
---|
106 | <?python |
---|
107 | ops = ['GetCapabilities', 'DescribeFeature', 'GetFeature'] |
---|
108 | eops = [x for x in om.operationDict.keys() if x not in ops] |
---|
109 | ?> |
---|
110 | <py:for each="opName in ops" py:if="opName in om.operationDict.keys()"> |
---|
111 | <ows:Operation name="${opName}"> |
---|
112 | <ows:DCP> |
---|
113 | <ows:HTTP> |
---|
114 | <ows:Get xlink:type="simple" xlink:href="${om.operationDict[opName].get.href}"/> |
---|
115 | </ows:HTTP> |
---|
116 | </ows:DCP> |
---|
117 | </ows:Operation> |
---|
118 | </py:for> |
---|
119 | <ows:ExtendedCapabilities> |
---|
120 | <Request> |
---|
121 | <py:for each="opName in eops"> |
---|
122 | <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/> |
---|
123 | </py:for> |
---|
124 | <py:for each="opName in eops"> |
---|
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 | </ows:ExtendedCapabilities> |
---|
133 | </py:if> |
---|
134 | </ows:OperationsMetadata> |
---|
135 | |
---|
136 | <FeatureTypeList py:if="c.capabilities.contents is not None"> |
---|
137 | <FeatureType py:for="ds in c.capabilities.contents.datasetSummaries" |
---|
138 | py:replace="markupLayer(ds)"> |
---|
139 | </FeatureType> |
---|
140 | </FeatureTypeList> |
---|
141 | <!-- TODO, Filter_Capabilities should be configurable --> |
---|
142 | <ogc:Filter_Capabilities> |
---|
143 | <ogc:Spatial_Capabilities> |
---|
144 | <ogc:GeometryOperands> |
---|
145 | <ogc:GeometryOperand>gml:Envelope</ogc:GeometryOperand> |
---|
146 | </ogc:GeometryOperands> |
---|
147 | <ogc:SpatialOperators> |
---|
148 | <ogc:SpatialOperator name="BBOX"/> |
---|
149 | </ogc:SpatialOperators> |
---|
150 | </ogc:Spatial_Capabilities> |
---|
151 | <ogc:Scalar_Capabilities> |
---|
152 | <ogc:LogicalOperators></ogc:LogicalOperators> |
---|
153 | <ogc:ComparisonOperators><ogc:ComparisonOperator>Between</ogc:ComparisonOperator></ogc:ComparisonOperators> |
---|
154 | </ogc:Scalar_Capabilities> |
---|
155 | |
---|
156 | <ogc:Id_Capabilities> |
---|
157 | <ogc:FID/> |
---|
158 | </ogc:Id_Capabilities> |
---|
159 | </ogc:Filter_Capabilities> |
---|
160 | </WFS_Capabilities> |
---|