summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Format/WPSDescribeProcess.html
blob: f52fd213724b793fcf2608abec4f80828efd0a1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<html>
<head>
    <script src="../OLLoader.js"></script>
    <script type="text/javascript">

    function test_read_WPSDescribeProcess(t) {
        t.plan(17);

        var parser = new OpenLayers.Format.WPSDescribeProcess();
        var text =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<wps:ProcessDescriptions xml:lang="en" service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0"' +
'    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
'    xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"' +
'    xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink">' +
'    <ProcessDescription wps:processVersion="1.0.0" statusSupported="false"' +
'        storeSupported="false">' +
'        <ows:Identifier>JTS:buffer</ows:Identifier>' +
'        <ows:Title>Buffers a geometry using a certain distance</ows:Title>' +
'        <ows:Abstract>Buffers a geometry using a certain distance</ows:Abstract>' +
'        <DataInputs>' +
'            <Input maxOccurs="1" minOccurs="1">' +
'                <ows:Identifier>geom</ows:Identifier>' +
'                <ows:Title>geom</ows:Title>' +
'                <ows:Abstract>The geometry to be buffered</ows:Abstract>' +
'                <ComplexData>' +
'                    <Default>' +
'                        <Format>' +
'                            <MimeType>text/xml; subtype=gml/3.1.1</MimeType>' +
'                        </Format>' +
'                    </Default>' +
'                    <Supported>' +
'                        <Format>' +
'                            <MimeType>text/xml; subtype=gml/3.1.1</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>text/xml; subtype=gml/2.1.2</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>application/wkt</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>application/gml-3.1.1</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>application/gml-2.1.2</MimeType>' +
'                        </Format>' +
'                    </Supported>' +
'                </ComplexData>' +
'            </Input>' +
'            <Input maxOccurs="1" minOccurs="1">' +
'                <ows:Identifier>distance</ows:Identifier>' +
'                <ows:Title>distance</ows:Title>' +
'                <ows:Abstract>The distance (same unit of measure as the geometry)</ows:Abstract>' +
'                <LiteralData>' +
'                    <ows:DataType>xs:double</ows:DataType>' +
'                    <ows:AnyValue/>' +
'                </LiteralData>' +
'            </Input>' +
'            <Input maxOccurs="1" minOccurs="0">' +
'                <ows:Identifier>quadrantSegments</ows:Identifier>' +
'                <ows:Title>quadrantSegments</ows:Title>' +
'                <ows:Abstract>Number of quadrant segments. Use &gt; 0 for round joins, 0 for' +
'                    flat joins, &lt; 0 for mitred joins</ows:Abstract>' +
'                <LiteralData>' +
'                    <ows:DataType>xs:int</ows:DataType>' +
'                    <ows:AnyValue/>' +
'                </LiteralData>' +
'            </Input>' +
'            <Input maxOccurs="1" minOccurs="0">' +
'                <ows:Identifier>capStyle</ows:Identifier>' +
'                <ows:Title>capStyle</ows:Title>' +
'                <ows:Abstract>The buffer cap style, round, flat, square</ows:Abstract>' +
'                <LiteralData>' +
'                    <ows:AllowedValues>' +
'                        <ows:Value>Round</ows:Value>' +
'                        <ows:Value>Flat</ows:Value>' +
'                        <ows:Value>Square</ows:Value>' +
'                    </ows:AllowedValues>' +
'                </LiteralData>' +
'            </Input>' +
'        </DataInputs>' +
'        <ProcessOutputs>' +
'            <Output>' +
'                <ows:Identifier>result</ows:Identifier>' +
'                <ows:Title>result</ows:Title>' +
'                <ComplexOutput>' +
'                    <Default>' +
'                        <Format>' +
'                            <MimeType>text/xml; subtype=gml/3.1.1</MimeType>' +
'                        </Format>' +
'                    </Default>' +
'                    <Supported>' +
'                        <Format>' +
'                            <MimeType>text/xml; subtype=gml/3.1.1</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>text/xml; subtype=gml/2.1.2</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>application/wkt</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>application/gml-3.1.1</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>application/gml-2.1.2</MimeType>' +
'                        </Format>' +
'                    </Supported>' +
'                </ComplexOutput>' +
'            </Output>' +
'            <Output>' +
'                <ows:Identifier>literal</ows:Identifier>' +
'                <ows:Title>literal output</ows:Title>' +
'                <LiteralOutput>' +
'                   <ows:DataType ows:reference="http://www.w3.org/TR/xmlschema-2/#integer">integer</ows:DataType>'+
'                </LiteralOutput>' +
'            </Output>' +
'        </ProcessOutputs>' +
'    </ProcessDescription>' +
'</wps:ProcessDescriptions>';

        var res = parser.read(text);
        var buffer = res.processDescriptions["JTS:buffer"];
        t.eq(buffer.statusSupported, false, "statusSupported read correctly");
        t.eq(buffer.storeSupported, false, "storeSupported read correctly");
        t.eq(buffer.processVersion, "1.0.0", "processVersion read correctly");
        var capStyle = buffer.dataInputs[3];
        t.eq(capStyle.abstract, "The buffer cap style, round, flat, square", "capStyle abstract read correctly");
        t.eq(capStyle.minOccurs, 0, "capStyle minOccurs read correctly");
        t.eq(capStyle.maxOccurs, 1, "maxOccurs read correctly");
        t.eq(capStyle.literalData.allowedValues["Flat"], true, "capStyle allowedValues read correctly");
        var distance = buffer.dataInputs[1];
        t.eq(distance.literalData.anyValue, true, "distance anyValue read correctly");
        t.eq(distance.literalData.dataType, "xs:double", "distance dataType read correctly");
        var geom = buffer.dataInputs[0];
        t.eq(geom.complexData["default"].formats["text/xml; subtype=gml/3.1.1"], true, "geom complexData default read correctly");
        t.eq(geom.complexData["supported"].formats["application/gml-2.1.2"], true, "geom complexData supported read correctly [1/2]");
        t.eq(geom.complexData["supported"].formats["application/gml-3.1.1"], true, "geom complexData supported read correctly [2/2]");
        var result = buffer.processOutputs[0];
        t.eq(result.complexOutput["default"].formats["text/xml; subtype=gml/3.1.1"], true, "processOutputs default format read correctly");
        t.eq(result.complexOutput["supported"].formats["text/xml; subtype=gml/3.1.1"], true, "processOutputs supported format read correctly [1/2]");
        t.eq(result.complexOutput["supported"].formats["application/wkt"], true, "processOutputs supported format read correctly [1/2]");

        var literalresult = buffer.processOutputs[1];
        t.eq(literalresult.literalOutput.dataType, "integer", "processOutputs supported data type read corectly");

        text = '<?xml version="1.0" encoding="UTF-8"?>' +
'<wps:ProcessDescriptions service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0"' +
'    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en"' +
'    xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"' +
'    xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink">' +
'    <ProcessDescription wps:processVersion="1.0.0" statusSupported="false"' +
'        storeSupported="false">' +
'        <ows:Identifier>gt:VectorToRaster</ows:Identifier>' +
'        <ows:Title>Rasterize features</ows:Title>' +
'        <ows:Abstract>Rasterize all or selected features in a FeatureCollection</ows:Abstract>' +
'        <DataInputs>' +
'            <Input maxOccurs="1" minOccurs="0">' +
'                <ows:Identifier>bounds</ows:Identifier>' +
'                <ows:Title>Bounds</ows:Title>' +
'                <ows:Abstract>Bounds of the area to rasterize</ows:Abstract>' +
'                <BoundingBoxData>' +
'                    <Default>' +
'                        <CRS>EPSG:4326</CRS>' +
'                    </Default>' +
'                    <Supported>' +
'                        <CRS>EPSG:4326</CRS>' +
'                    </Supported>' +
'                </BoundingBoxData>' +
'            </Input>' +
'        </DataInputs>' +
'        <ProcessOutputs>' +
'            <Output>' +
'                <ows:Identifier>result</ows:Identifier>' +
'                <ows:Title>Result</ows:Title>' +
'                <ComplexOutput>' +
'                    <Default>' +
'                        <Format>' +
'                            <MimeType>image/tiff</MimeType>' +
'                        </Format>' +
'                    </Default>' +
'                    <Supported>' +
'                        <Format>' +
'                            <MimeType>image/tiff</MimeType>' +
'                        </Format>' +
'                        <Format>' +
'                            <MimeType>application/arcgrid</MimeType>' +
'                        </Format>' +
'                    </Supported>' +
'                </ComplexOutput>' +
'            </Output>' +
'        </ProcessOutputs>' +
'    </ProcessDescription>' +
'</wps:ProcessDescriptions>';

        res = parser.read(text);
        var vector2Raster = res.processDescriptions["gt:VectorToRaster"];
        t.eq(vector2Raster.dataInputs[0].boundingBoxData["default"].CRSs["EPSG:4326"], true, "BoundingBoxData CRS parsed correctly");
    }

    </script>
</head>
<body>
</body>
</html>