File: v1_1_0.html

package info (click to toggle)
openlayers 2.13.1%2Bds2-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 67,256 kB
  • sloc: xml: 7,435; python: 907; sh: 44; makefile: 19
file content (236 lines) | stat: -rw-r--r-- 10,764 bytes parent folder | download | duplicates (5)
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<html>
<head>
  <script src="../../OLLoader.js"></script>
  <script type="text/javascript">

    function test_initialize(t) {
        t.plan(1);

        var format = new OpenLayers.Format.WFST.v1_1_0({});
        t.ok(format instanceof OpenLayers.Format.WFST.v1_1_0, "constructor returns instance");
    }
    
    function test_read(t) {
        t.plan(3);
        
        var data = readXML("TransactionResponse");        
        var format = new OpenLayers.Format.WFST.v1_1_0({
            featureNS: "http://www.openplans.org/topp",
            featureType: "states"
        });
        var result = format.read(data);
        t.eq(result.insertIds[0], "parcelle.40", "First InsertId read correctly");
        t.eq(result.insertIds[1], "parcelle.41", "Second InsertId read correctly");
        t.eq(result.success, true, "Success read correctly");
    }

    function test_read_hits(t) {
        t.plan(1);
        var data = readXML("NumberOfFeatures");
        var format = new OpenLayers.Format.WFST.v1_1_0({
            featureNS: "http://mapserver.gis.umn.edu/mapserver",
            featureType: "AAA64"
        });
        var result = format.read(data, {output: "object"});
        t.eq(result.numberOfFeatures, 625, "numberOfFeatures of FeatureCollection correctly read");
    }

    function test_read_boundedBy(t) {
        t.plan(4);
        var data = readXML("boundedBy");
        var format = new OpenLayers.Format.WFST.v1_1_0({
            featureNS: "http://mapserver.gis.umn.edu/mapserver",
            featureType: "AAA212"
        });
        var result = format.read(data, {output: "object"});
        var bounds = result.bounds;
        t.eq(bounds.left.toFixed(3), '3197.880', "Left bounds of the feature collection correctly parsed");
        t.eq(bounds.bottom.toFixed(3), '306457.313', "Bottom bounds of the feature collection correctly parsed");
        t.eq(bounds.right.toFixed(3), '280339.156', "Right bounds of the feature collection correctly parsed");
        t.eq(bounds.top.toFixed(3), '613850.438', "Top bounds of the feature collection corectly parsed");
    }

    function test_write(t) {

        var format = new OpenLayers.Format.WFST.v1_1_0({
            featureNS: "http://www.openplans.org/topp",
            featureType: "states",
            featurePrefix: "topp",
            srsName: "urn:ogc:def:crs:EPSG::4326",
            geometryName: "the_geom"
        });

        var cases = [{
            id: "query0",
            writer: "wfs:Query",
            arg: {
                filter: new OpenLayers.Filter.Spatial({
                    type: OpenLayers.Filter.Spatial.BBOX,
                    value: new OpenLayers.Bounds (1,2,3,4)
                })
            }
        }, {
            id: "getfeature0",
            writer: "wfs:GetFeature",
            arg: {
                resultType: "hits",
                propertyNames: ["STATE_NAME", "STATE_FIPS", "STATE_ABBR"]
            }
        }, {
            id: "getfeature1",
            writer: "wfs:GetFeature",
            arg: {
                count: 10,
                startIndex: 20
            }
        }];
        
        t.plan(cases.length);
        
        var test, got, exp;
        for(var i=0; i<cases.length; ++i) {
            test = cases[i];
            exp = readXML(test.id);
            got = format.writeNode(test.writer, test.arg);
            t.xml_eq(got, exp, test.id + ": correct request");
        }
    }

    function test_write_poorconfig(t) {
        t.plan(1);
        var format = new OpenLayers.Format.WFST.v1_1_0({
            featureType: "states",
            featurePrefix: "topp"
        });
        var exp = "topp:states";
        var got = format.writeNode("wfs:Query").getAttribute("typeName");
        t.eq(got, exp, "Query without featureNS but with featurePrefix queries for the correct featureType");
    }

    var xmlFormat = new OpenLayers.Format.XML();
    function readXML(id) {
        var xml = document.getElementById(id).firstChild.nodeValue;
        return xmlFormat.read(xml).documentElement;        
    }

  </script>
</head>
<body>
<div id="map" style="width:512px; height:256px"> </div>
<div id="NumberOfFeatures"><!--
<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection
   xmlns:rws="http://mapserver.gis.umn.edu/mapserver"
   xmlns:gml="http://www.opengis.net/gml"
   xmlns:wfs="http://www.opengis.net/wfs"
   xmlns:ogc="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://intranet.rijkswaterstaat.nl/services/geoservices/nwb_wegen?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=feature:AAA64&amp;OUTPUTFORMAT=text/xml; subtype=gml/3.1.1  http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" numberOfFeatures="625">
</wfs:FeatureCollection>
--></div>
<div id="TransactionResponse"><!--
<wfs:TransactionResponse version="1.1.0" xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:sf="http://www.openplans.org/spearfish" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink">
    <wfs:TransactionSummary>
        <wfs:totalInserted>0</wfs:totalInserted>
        <wfs:totalUpdated>1</wfs:totalUpdated>
        <wfs:totalDeleted>0</wfs:totalDeleted>
    </wfs:TransactionSummary>
    <wfs:TransactionResults/>
    <wfs:InsertResults>
        <wfs:Feature>
            <ogc:FeatureId fid="parcelle.40"/>
        </wfs:Feature>
        <wfs:Feature>
            <ogc:FeatureId fid="parcelle.41"/>
        </wfs:Feature>
    </wfs:InsertResults>
</wfs:TransactionResponse>
--></div>
<div id="query0"><!--
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
    <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:BBOX>
            <ogc:PropertyName>the_geom</ogc:PropertyName>
            <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG::4326">
                <gml:lowerCorner>1 2</gml:lowerCorner>
                <gml:upperCorner>3 4</gml:upperCorner>
            </gml:Envelope>
        </ogc:BBOX>
    </ogc:Filter>
</wfs:Query>
--></div>
<div id="getfeature0"><!--
<wfs:GetFeature service="WFS" version="1.1.0" resultType="hits" xmlns:topp="http://www.openplans.org/topp"
                xmlns:wfs="http://www.opengis.net/wfs"
                xmlns:ogc="http://www.opengis.net/ogc"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
    <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
        <wfs:PropertyName>STATE_NAME</wfs:PropertyName>
        <wfs:PropertyName>STATE_FIPS</wfs:PropertyName>
        <wfs:PropertyName>STATE_ABBR</wfs:PropertyName>
    </wfs:Query>
</wfs:GetFeature>
--></div>
<div id="getfeature1"><!--
<wfs:GetFeature service="WFS" version="1.1.0" startIndex="20" count="10" xmlns:topp="http://www.openplans.org/topp"
                xmlns:wfs="http://www.opengis.net/wfs"
                xmlns:ogc="http://www.opengis.net/ogc"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
    <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
    </wfs:Query>
</wfs:GetFeature>
--></div>
<div id="boundedBy"><!--
<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection
   xmlns:rws="http://mapserver.gis.umn.edu/mapserver"
   xmlns:gml="http://www.opengis.net/gml"
   xmlns:wfs="http://www.opengis.net/wfs"
   xmlns:ogc="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://ontwikkel.intranet.rijkswaterstaat.nl/services/geoservices/ov_zonering?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=AAA212&amp;OUTPUTFORMAT=text/xml; subtype=gml/3.1.1  http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
      <gml:boundedBy>
      	<gml:Envelope srsName="EPSG:28992">
      		<gml:lowerCorner>3197.880000 306457.313000</gml:lowerCorner>
      		<gml:upperCorner>280339.156000 613850.438000</gml:upperCorner>
      	</gml:Envelope>
      </gml:boundedBy>
    <gml:featureMember>

      <rws:AAA212 gml:id="AAA212.791">
        <gml:boundedBy>
        	<gml:Envelope srsName="EPSG:28992">
        		<gml:lowerCorner>196507.469000 502347.938000</gml:lowerCorner>
        		<gml:upperCorner>202430.844000 510383.719000</gml:upperCorner>
        	</gml:Envelope>
        </gml:boundedBy>
        <rws:geometry>

          <gml:MultiSurface srsName="EPSG:28992">
            <gml:surfaceMembers>
              <gml:Polygon>
                <gml:exterior>
                  <gml:LinearRing>
                    <gml:posList srsDimension="2">200448.047000 510383.719000 198475.031000 509253.875000 198477.422000 507339.688000 196507.469000 505841.969000 196507.625000 504980.281000 196621.359000 505029.969000 196825.328000 505114.000000 197310.031000 505183.469000 197636.609000 505148.750000 197837.594000 505061.563000 197941.031000 504953.688000 198003.094000 504817.719000 198023.781000 504721.688000 198016.391000 504597.531000 197907.234000 504363.219000 197716.734000 504013.969000 197700.156000 503567.563000 197775.531000 503373.969000 197930.688000 503153.781000 198034.234000 503045.594000 198170.078000 502932.125000 198504.047000 502725.250000 198858.719000 502550.875000 199138.000000 502460.719000 199336.000000 502347.938000 199044.125000 504910.969000 199549.359000 507065.781000 200280.594000 506878.938000 202430.844000 507474.625000 202430.844000 508850.906000 200448.047000 510383.719000 </gml:posList>
                  </gml:LinearRing>
                </gml:exterior>

              </gml:Polygon>
            </gml:surfaceMembers>
          </gml:MultiSurface>
        </rws:geometry>
        <rws:OBJECTID>791</rws:OBJECTID>
        <rws:HECTARES>1800.89</rws:HECTARES>
        <rws:ZONENR>4620</rws:ZONENR>

        <rws:NULZONES> </rws:NULZONES>
        <rws:AREA>0</rws:AREA>
        <rws:PERIMETER>24305.1</rws:PERIMETER>
      </rws:AAA212>
    </gml:featureMember>
</wfs:FeatureCollection>
--></div>
</body>
</html>