Ticket #1639: 1639-r1639-A0.patch
| File 1639-r1639-A0.patch, 131.7 kB (added by ahocevar, 1 year ago) |
|---|
-
tests/Format/GML/cases.js
old new 1 var xml = new OpenLayers.Format.XML(); 2 function readXML(file) { 3 return xml.read(document.getElementById(file).firstChild.nodeValue); 4 } 5 6 var cases = { 7 8 "v2/point-coord.xml": new OpenLayers.Geometry.Point(1, 2), 9 10 "v2/point-coordinates.xml": new OpenLayers.Geometry.Point(1, 2), 11 12 "v2/linestring-coord.xml": new OpenLayers.Geometry.LineString([ 13 new OpenLayers.Geometry.Point(1, 2), 14 new OpenLayers.Geometry.Point(3, 4) 15 ]), 16 17 "v2/linestring-coordinates.xml": new OpenLayers.Geometry.LineString([ 18 new OpenLayers.Geometry.Point(1, 2), 19 new OpenLayers.Geometry.Point(3, 4) 20 ]), 21 22 "v2/linearring-coord.xml": new OpenLayers.Geometry.LinearRing([ 23 new OpenLayers.Geometry.Point(1, 2), 24 new OpenLayers.Geometry.Point(3, 4), 25 new OpenLayers.Geometry.Point(5, 6), 26 new OpenLayers.Geometry.Point(1, 2) 27 ]), 28 29 "v2/linearring-coordinates.xml": new OpenLayers.Geometry.LinearRing([ 30 new OpenLayers.Geometry.Point(1, 2), 31 new OpenLayers.Geometry.Point(3, 4), 32 new OpenLayers.Geometry.Point(5, 6), 33 new OpenLayers.Geometry.Point(1, 2) 34 ]), 35 36 "v2/polygon-coord.xml": new OpenLayers.Geometry.Polygon([ 37 new OpenLayers.Geometry.LinearRing([ 38 new OpenLayers.Geometry.Point(1, 2), 39 new OpenLayers.Geometry.Point(3, 4), 40 new OpenLayers.Geometry.Point(5, 6), 41 new OpenLayers.Geometry.Point(1, 2) 42 ]), 43 new OpenLayers.Geometry.LinearRing([ 44 new OpenLayers.Geometry.Point(2, 3), 45 new OpenLayers.Geometry.Point(4, 5), 46 new OpenLayers.Geometry.Point(6, 7), 47 new OpenLayers.Geometry.Point(2, 3) 48 ]), 49 new OpenLayers.Geometry.LinearRing([ 50 new OpenLayers.Geometry.Point(3, 4), 51 new OpenLayers.Geometry.Point(5, 6), 52 new OpenLayers.Geometry.Point(7, 8), 53 new OpenLayers.Geometry.Point(3, 4) 54 ]) 55 ]), 56 57 "v2/polygon-coordinates.xml": new OpenLayers.Geometry.Polygon([ 58 new OpenLayers.Geometry.LinearRing([ 59 new OpenLayers.Geometry.Point(1, 2), 60 new OpenLayers.Geometry.Point(3, 4), 61 new OpenLayers.Geometry.Point(5, 6), 62 new OpenLayers.Geometry.Point(1, 2) 63 ]), 64 new OpenLayers.Geometry.LinearRing([ 65 new OpenLayers.Geometry.Point(2, 3), 66 new OpenLayers.Geometry.Point(4, 5), 67 new OpenLayers.Geometry.Point(6, 7), 68 new OpenLayers.Geometry.Point(2, 3) 69 ]), 70 new OpenLayers.Geometry.LinearRing([ 71 new OpenLayers.Geometry.Point(3, 4), 72 new OpenLayers.Geometry.Point(5, 6), 73 new OpenLayers.Geometry.Point(7, 8), 74 new OpenLayers.Geometry.Point(3, 4) 75 ]) 76 ]), 77 78 "v2/multipoint-coord.xml": new OpenLayers.Geometry.MultiPoint([ 79 new OpenLayers.Geometry.Point(1, 2), 80 new OpenLayers.Geometry.Point(2, 3), 81 new OpenLayers.Geometry.Point(3, 4) 82 ]), 83 84 "v2/multipoint-coordinates.xml": new OpenLayers.Geometry.MultiPoint([ 85 new OpenLayers.Geometry.Point(1, 2), 86 new OpenLayers.Geometry.Point(2, 3), 87 new OpenLayers.Geometry.Point(3, 4) 88 ]), 89 90 "v2/multilinestring-coord.xml": new OpenLayers.Geometry.MultiLineString([ 91 new OpenLayers.Geometry.LineString([ 92 new OpenLayers.Geometry.Point(1, 2), 93 new OpenLayers.Geometry.Point(2, 3) 94 ]), 95 new OpenLayers.Geometry.LineString([ 96 new OpenLayers.Geometry.Point(3, 4), 97 new OpenLayers.Geometry.Point(4, 5) 98 ]) 99 ]), 100 101 "v2/multilinestring-coordinates.xml": new OpenLayers.Geometry.MultiLineString([ 102 new OpenLayers.Geometry.LineString([ 103 new OpenLayers.Geometry.Point(1, 2), 104 new OpenLayers.Geometry.Point(2, 3) 105 ]), 106 new OpenLayers.Geometry.LineString([ 107 new OpenLayers.Geometry.Point(3, 4), 108 new OpenLayers.Geometry.Point(4, 5) 109 ]) 110 ]), 111 112 "v2/multipolygon-coord.xml": new OpenLayers.Geometry.MultiPolygon([ 113 new OpenLayers.Geometry.Polygon([ 114 new OpenLayers.Geometry.LinearRing([ 115 new OpenLayers.Geometry.Point(1, 2), 116 new OpenLayers.Geometry.Point(3, 4), 117 new OpenLayers.Geometry.Point(5, 6), 118 new OpenLayers.Geometry.Point(1, 2) 119 ]), 120 new OpenLayers.Geometry.LinearRing([ 121 new OpenLayers.Geometry.Point(2, 3), 122 new OpenLayers.Geometry.Point(4, 5), 123 new OpenLayers.Geometry.Point(6, 7), 124 new OpenLayers.Geometry.Point(2, 3) 125 ]), 126 new OpenLayers.Geometry.LinearRing([ 127 new OpenLayers.Geometry.Point(3, 4), 128 new OpenLayers.Geometry.Point(5, 6), 129 new OpenLayers.Geometry.Point(7, 8), 130 new OpenLayers.Geometry.Point(3, 4) 131 ]) 132 ]), 133 new OpenLayers.Geometry.Polygon([ 134 new OpenLayers.Geometry.LinearRing([ 135 new OpenLayers.Geometry.Point(1, 2), 136 new OpenLayers.Geometry.Point(3, 4), 137 new OpenLayers.Geometry.Point(5, 6), 138 new OpenLayers.Geometry.Point(1, 2) 139 ]) 140 ]) 141 ]), 142 143 "v2/multipolygon-coordinates.xml": new OpenLayers.Geometry.MultiPolygon([ 144 new OpenLayers.Geometry.Polygon([ 145 new OpenLayers.Geometry.LinearRing([ 146 new OpenLayers.Geometry.Point(1, 2), 147 new OpenLayers.Geometry.Point(3, 4), 148 new OpenLayers.Geometry.Point(5, 6), 149 new OpenLayers.Geometry.Point(1, 2) 150 ]), 151 new OpenLayers.Geometry.LinearRing([ 152 new OpenLayers.Geometry.Point(2, 3), 153 new OpenLayers.Geometry.Point(4, 5), 154 new OpenLayers.Geometry.Point(6, 7), 155 new OpenLayers.Geometry.Point(2, 3) 156 ]), 157 new OpenLayers.Geometry.LinearRing([ 158 new OpenLayers.Geometry.Point(3, 4), 159 new OpenLayers.Geometry.Point(5, 6), 160 new OpenLayers.Geometry.Point(7, 8), 161 new OpenLayers.Geometry.Point(3, 4) 162 ]) 163 ]), 164 new OpenLayers.Geometry.Polygon([ 165 new OpenLayers.Geometry.LinearRing([ 166 new OpenLayers.Geometry.Point(1, 2), 167 new OpenLayers.Geometry.Point(3, 4), 168 new OpenLayers.Geometry.Point(5, 6), 169 new OpenLayers.Geometry.Point(1, 2) 170 ]) 171 ]) 172 ]), 173 174 "v2/geometrycollection-coordinates.xml": new OpenLayers.Geometry.Collection([ 175 new OpenLayers.Geometry.Point(1, 2), 176 new OpenLayers.Geometry.LineString([ 177 new OpenLayers.Geometry.Point(1, 2), 178 new OpenLayers.Geometry.Point(3, 4) 179 ]), 180 new OpenLayers.Geometry.Polygon([ 181 new OpenLayers.Geometry.LinearRing([ 182 new OpenLayers.Geometry.Point(1, 2), 183 new OpenLayers.Geometry.Point(3, 4), 184 new OpenLayers.Geometry.Point(5, 6), 185 new OpenLayers.Geometry.Point(1, 2) 186 ]), 187 new OpenLayers.Geometry.LinearRing([ 188 new OpenLayers.Geometry.Point(2, 3), 189 new OpenLayers.Geometry.Point(4, 5), 190 new OpenLayers.Geometry.Point(6, 7), 191 new OpenLayers.Geometry.Point(2, 3) 192 ]), 193 new OpenLayers.Geometry.LinearRing([ 194 new OpenLayers.Geometry.Point(3, 4), 195 new OpenLayers.Geometry.Point(5, 6), 196 new OpenLayers.Geometry.Point(7, 8), 197 new OpenLayers.Geometry.Point(3, 4) 198 ]) 199 ]) 200 ]), 201 202 "v2/box-coord.xml": new OpenLayers.Bounds(1, 2, 3, 4), 203 204 "v2/box-coordinates.xml": new OpenLayers.Bounds(1, 2, 3, 4) 205 206 }; 207 208 // cases for v3 use the same geometries 209 OpenLayers.Util.extend(cases, { 210 "v3/point.xml": cases["v2/point-coordinates.xml"], 211 "v3/linestring.xml": cases["v2/linestring-coordinates.xml"], 212 "v3/polygon.xml": cases["v2/polygon-coordinates.xml"], 213 "v3/multipoint-singular.xml": cases["v2/multipoint-coordinates.xml"], 214 "v3/multipoint-plural.xml": cases["v2/multipoint-coordinates.xml"], 215 "v3/multilinestring-singular.xml": cases["v2/multilinestring-coordinates.xml"], 216 "v3/multilinestring-plural.xml": cases["v2/multilinestring-coordinates.xml"], 217 "v3/multipolygon-singular.xml": cases["v2/multipolygon-coordinates.xml"], 218 "v3/multipolygon-plural.xml": cases["v2/multipolygon-coordinates.xml"], 219 "v3/multisurface-singular.xml": cases["v2/multipolygon-coordinates.xml"], 220 "v3/multisurface-plural.xml": cases["v2/multipolygon-coordinates.xml"], 221 "v3/envelope.xml": cases["v2/box-coordinates.xml"] 222 }); -
tests/Format/GML/v2.html
old new 1 <?xml version="1.0" encoding="utf-8"?> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <script src="../../../lib/OpenLayers.js"></script> 5 <script src="cases.js"></script> 6 <script type="text/javascript"> 7 8 function test_readNode_geometry(t) { 9 var files = [ 10 "v2/point-coord.xml", "v2/point-coordinates.xml", 11 "v2/linestring-coord.xml", "v2/linestring-coordinates.xml", 12 "v2/polygon-coord.xml", "v2/polygon-coordinates.xml", 13 "v2/multipoint-coord.xml", "v2/multipoint-coordinates.xml", 14 "v2/multilinestring-coord.xml", "v2/multilinestring-coordinates.xml", 15 "v2/multipolygon-coord.xml", "v2/multipolygon-coordinates.xml", 16 "v2/geometrycollection-coordinates.xml" 17 ]; 18 19 var len = files.length; 20 t.plan(len); 21 22 var format = new OpenLayers.Format.GML.v2({ 23 featureType: "feature", 24 featureNS: "http://example.com/feature" 25 }); 26 var file, doc, expect, out; 27 for(var i=0; i<len; ++i) { 28 file = files[i]; 29 expect = cases[file]; 30 if(expect) { 31 doc = readXML(file); 32 if(doc && doc.documentElement) { 33 out = format.readNode(doc.documentElement); 34 if(out.components && out.components.length == 1) { 35 t.geom_eq(out.components[0], expect, "[" + file + "] geometry read"); 36 } else { 37 t.fail("[" + file + "] gml parsing"); 38 } 39 } else { 40 t.fail("[" + file + "] xml parsing"); 41 } 42 } else { 43 t.fail("[" + file + "] case not found"); 44 } 45 } 46 47 } 48 49 function test_readNode_bounds(t) { 50 var files = ["v2/box-coord.xml", "v2/box-coordinates.xml"]; 51 52 var len = files.length; 53 t.plan(len); 54 55 var file, doc, expect, got; 56 var format = new OpenLayers.Format.GML.v2({ 57 featureType: "feature", 58 featureNS: "http://example.com/feature" 59 }); 60 for(var i=0; i<len; ++i) { 61 file = files[i]; 62 expect = cases[file]; 63 if(expect) { 64 doc = readXML(file); 65 if(doc && doc.documentElement) { 66 out = format.readNode(doc.documentElement); 67 if(out.components && out.components.length == 1) { 68 got = out.components[0]; 69 if(got instanceof OpenLayers.Bounds) { 70 t.ok(out.components[0].equals(expect), "[" + file + "] bounds read") 71 } else { 72 t.fail("[" + file + "] expected a bounds, got " + got); 73 } 74 } else { 75 t.fail("[" + file + "] gml parsing"); 76 } 77 } else { 78 t.fail("[" + file + "] xml parsing"); 79 } 80 } else { 81 t.fail("[" + file + "] case not found"); 82 } 83 } 84 85 } 86 87 function test_writeNode_geometry(t) { 88 // we only care to write the 'coordinates' variant of GML 2 89 var files = [ 90 "v2/point-coordinates.xml", 91 "v2/linestring-coordinates.xml", 92 "v2/polygon-coordinates.xml", 93 "v2/multipoint-coordinates.xml", 94 "v2/multilinestring-coordinates.xml", 95 "v2/multipolygon-coordinates.xml", 96 "v2/geometrycollection-coordinates.xml" 97 ]; 98 99 var len = files.length; 100 t.plan(len); 101 102 var format = new OpenLayers.Format.GML.v2({ 103 featureType: "feature", 104 featureNS: "http://example.com/feature", 105 srsName: "foo" // GML geometry collections require srsName, we only write if provided 106 }); 107 var file, geom, doc, node; 108 for(var i=0; i<len; ++i) { 109 file = files[i]; 110 geom = cases[file]; 111 if(geom) { 112 doc = readXML(file); 113 if(doc && doc.documentElement) { 114 node = format.writeNode("feature:_geometry", geom); 115 t.xml_eq(node.firstChild, doc.documentElement, "[" + file + "] geometry written"); 116 } else { 117 t.fail("[" + file + "] xml parsing"); 118 } 119 } else { 120 t.fail("[" + file + "] case not found"); 121 } 122 } 123 } 124 125 function test_writeNode_bounds(t) { 126 // we only care to write the 'coordinates' variant of GML 2 127 var files = [ 128 "v2/box-coordinates.xml" 129 ]; 130 131 var len = files.length; 132 t.plan(len); 133 134 var format = new OpenLayers.Format.GML.v2({ 135 featureType: "feature", 136 featureNS: "http://example.com/feature", 137 srsName: "foo" // GML box does not require srsName, we only write if provided 138 }); 139 var file, bounds, doc, node; 140 for(var i=0; i<len; ++i) { 141 file = files[i]; 142 bounds = cases[file]; 143 if(bounds) { 144 doc = readXML(file); 145 if(doc && doc.documentElement) { 146 node = format.writeNode("gml:Box", bounds); 147 t.xml_eq(node, doc.documentElement, "[" + file + "] bounds written"); 148 } else { 149 t.fail("[" + file + "] xml parsing"); 150 } 151 } else { 152 t.fail("[" + file + "] case not found"); 153 } 154 } 155 } 156 157 function test_read(t) { 158 t.plan(8); 159 var doc = readXML("v2/topp-states.xml"); 160 var format = new OpenLayers.Format.GML.v2({ 161 featureType: "states", 162 featureNS: "http://www.openplans.org/topp", 163 geometryName: "the_geom" 164 }); 165 var features = format.read(doc.documentElement); 166 167 t.eq(features.length, 3, "read 3 features"); 168 var feature = features[0]; 169 t.eq(feature.fid, "states.1", "read fid"); 170 t.eq(feature.geometry.CLASS_NAME, "OpenLayers.Geometry.MultiPolygon", 171 "read multipolygon geometry"); 172 var attributes = feature.attributes; 173 t.eq(attributes["STATE_NAME"], "Illinois", "read STATE_NAME"); 174 t.eq(attributes["STATE_FIPS"], "17", "read STATE_FIPS"); 175 t.eq(attributes["SUB_REGION"], "E N Cen", "read SUB_REGION"); 176 t.eq(attributes["STATE_ABBR"], "IL", "read STATE_ABBR"); 177 t.eq(attributes["LAND_KM"], "143986.61", "read LAND_KM"); 178 } 179 180 function test_write(t) { 181 t.plan(1); 182 var doc = readXML("v2/topp-states.xml"); 183 var format = new OpenLayers.Format.GML.v2({ 184 featureType: "states", 185 featureNS: "http://www.openplans.org/topp", 186 geometryName: "the_geom", 187 schemaLocation: "http://www.openplans.org/topp http://sigma.openplans.org:80/geoserver/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=topp:states http://www.opengis.net/wfs http://sigma.openplans.org:80/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd", 188 srsName: "http://www.opengis.net/gml/srs/epsg.xml#4326" 189 }); 190 var features = format.read(doc.documentElement); 191 192 var got = format.write(features); 193 t.xml_eq(got, doc.documentElement, "wfs:FeatureCollection round trip"); 194 195 } 196 197 </script> 198 </head> 199 <body> 200 <div id="v2/point-coord.xml"><!-- 201 <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 202 <gml:coord> 203 <gml:X>1</gml:X> 204 <gml:Y>2</gml:Y> 205 </gml:coord> 206 </gml:Point> 207 --></div> 208 <div id="v2/point-coordinates.xml"><!-- 209 <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 210 <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates> 211 </gml:Point> 212 --></div> 213 <div id="v2/linestring-coord.xml"><!-- 214 <gml:LineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 215 <gml:coord> 216 <gml:X>1</gml:X> 217 <gml:Y>2</gml:Y> 218 </gml:coord> 219 <gml:coord> 220 <gml:X>3</gml:X> 221 <gml:Y>4</gml:Y> 222 </gml:coord> 223 </gml:LineString> 224 --></div> 225 <div id="v2/linestring-coordinates.xml"><!-- 226 <gml:LineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 227 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4</gml:coordinates> 228 </gml:LineString> 229 --></div> 230 <div id="v2/polygon-coord.xml"><!-- 231 <gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 232 <gml:outerBoundaryIs> 233 <gml:LinearRing> 234 <gml:coord> 235 <gml:X>1</gml:X> 236 <gml:Y>2</gml:Y> 237 </gml:coord> 238 <gml:coord> 239 <gml:X>3</gml:X> 240 <gml:Y>4</gml:Y> 241 </gml:coord> 242 <gml:coord> 243 <gml:X>5</gml:X> 244 <gml:Y>6</gml:Y> 245 </gml:coord> 246 <gml:coord> 247 <gml:X>1</gml:X> 248 <gml:Y>2</gml:Y> 249 </gml:coord> 250 </gml:LinearRing> 251 </gml:outerBoundaryIs> 252 <gml:innerBoundaryIs> 253 <gml:LinearRing> 254 <gml:coord> 255 <gml:X>2</gml:X> 256 <gml:Y>3</gml:Y> 257 </gml:coord> 258 <gml:coord> 259 <gml:X>4</gml:X> 260 <gml:Y>5</gml:Y> 261 </gml:coord> 262 <gml:coord> 263 <gml:X>6</gml:X> 264 <gml:Y>7</gml:Y> 265 </gml:coord> 266 <gml:coord> 267 <gml:X>2</gml:X> 268 <gml:Y>3</gml:Y> 269 </gml:coord> 270 </gml:LinearRing> 271 </gml:innerBoundaryIs> 272 <gml:innerBoundaryIs> 273 <gml:LinearRing> 274 <gml:coord> 275 <gml:X>3</gml:X> 276 <gml:Y>4</gml:Y> 277 </gml:coord> 278 <gml:coord> 279 <gml:X>5</gml:X> 280 <gml:Y>6</gml:Y> 281 </gml:coord> 282 <gml:coord> 283 <gml:X>7</gml:X> 284 <gml:Y>8</gml:Y> 285 </gml:coord> 286 <gml:coord> 287 <gml:X>3</gml:X> 288 <gml:Y>4</gml:Y> 289 </gml:coord> 290 </gml:LinearRing> 291 </gml:innerBoundaryIs> 292 </gml:Polygon> 293 --></div> 294 <div id="v2/polygon-coordinates.xml"><!-- 295 <gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 296 <gml:outerBoundaryIs> 297 <gml:LinearRing> 298 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates> 299 </gml:LinearRing> 300 </gml:outerBoundaryIs> 301 <gml:innerBoundaryIs> 302 <gml:LinearRing> 303 <gml:coordinates decimal="." cs="," ts=" ">2,3 4,5 6,7 2,3</gml:coordinates> 304 </gml:LinearRing> 305 </gml:innerBoundaryIs> 306 <gml:innerBoundaryIs> 307 <gml:LinearRing> 308 <gml:coordinates decimal="." cs="," ts=" ">3,4 5,6 7,8 3,4</gml:coordinates> 309 </gml:LinearRing> 310 </gml:innerBoundaryIs> 311 </gml:Polygon> 312 --></div> 313 <div id="v2/multipoint-coord.xml"><!-- 314 <gml:MultiPoint xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 315 <gml:pointMember> 316 <gml:Point> 317 <gml:coord> 318 <gml:X>1</gml:X> 319 <gml:Y>2</gml:Y> 320 </gml:coord> 321 </gml:Point> 322 </gml:pointMember> 323 <gml:pointMember> 324 <gml:Point> 325 <gml:coord> 326 <gml:X>2</gml:X> 327 <gml:Y>3</gml:Y> 328 </gml:coord> 329 </gml:Point> 330 </gml:pointMember> 331 <gml:pointMember> 332 <gml:Point> 333 <gml:coord> 334 <gml:X>3</gml:X> 335 <gml:Y>4</gml:Y> 336 </gml:coord> 337 </gml:Point> 338 </gml:pointMember> 339 </gml:MultiPoint> 340 --></div> 341 <div id="v2/multipoint-coordinates.xml"><!-- 342 <gml:MultiPoint xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 343 <gml:pointMember> 344 <gml:Point> 345 <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates> 346 </gml:Point> 347 </gml:pointMember> 348 <gml:pointMember> 349 <gml:Point> 350 <gml:coordinates decimal="." cs="," ts=" ">2,3</gml:coordinates> 351 </gml:Point> 352 </gml:pointMember> 353 <gml:pointMember> 354 <gml:Point> 355 <gml:coordinates decimal="." cs="," ts=" ">3,4</gml:coordinates> 356 </gml:Point> 357 </gml:pointMember> 358 </gml:MultiPoint> 359 --></div> 360 <div id="v2/multilinestring-coord.xml"><!-- 361 <gml:MultiLineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 362 <gml:lineStringMember> 363 <gml:LineString> 364 <gml:coord> 365 <gml:X>1</gml:X> 366 <gml:Y>2</gml:Y> 367 </gml:coord> 368 <gml:coord> 369 <gml:X>2</gml:X> 370 <gml:Y>3</gml:Y> 371 </gml:coord> 372 </gml:LineString> 373 </gml:lineStringMember> 374 <gml:lineStringMember> 375 <gml:LineString> 376 <gml:coord> 377 <gml:X>3</gml:X> 378 <gml:Y>4</gml:Y> 379 </gml:coord> 380 <gml:coord> 381 <gml:X>4</gml:X> 382 <gml:Y>5</gml:Y> 383 </gml:coord> 384 </gml:LineString> 385 </gml:lineStringMember> 386 </gml:MultiLineString> 387 --></div> 388 <div id="v2/multilinestring-coordinates.xml"><!-- 389 <gml:MultiLineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 390 <gml:lineStringMember> 391 <gml:LineString> 392 <gml:coordinates decimal="." cs="," ts=" ">1,2 2,3</gml:coordinates> 393 </gml:LineString> 394 </gml:lineStringMember> 395 <gml:lineStringMember> 396 <gml:LineString> 397 <gml:coordinates decimal="." cs="," ts=" ">3,4 4,5</gml:coordinates> 398 </gml:LineString> 399 </gml:lineStringMember> 400 </gml:MultiLineString> 401 --></div> 402 <div id="v2/multipolygon-coord.xml"><!-- 403 <gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 404 <gml:polygonMember> 405 <gml:Polygon> 406 <gml:outerBoundaryIs> 407 <gml:LinearRing> 408 <gml:coord> 409 <gml:X>1</gml:X> 410 <gml:Y>2</gml:Y> 411 </gml:coord> 412 <gml:coord> 413 <gml:X>3</gml:X> 414 <gml:Y>4</gml:Y> 415 </gml:coord> 416 <gml:coord> 417 <gml:X>5</gml:X> 418 <gml:Y>6</gml:Y> 419 </gml:coord> 420 <gml:coord> 421 <gml:X>1</gml:X> 422 <gml:Y>2</gml:Y> 423 </gml:coord> 424 </gml:LinearRing> 425 </gml:outerBoundaryIs> 426 <gml:innerBoundaryIs> 427 <gml:LinearRing> 428 <gml:coord> 429 <gml:X>2</gml:X> 430 <gml:Y>3</gml:Y> 431 </gml:coord> 432 <gml:coord> 433 <gml:X>4</gml:X> 434 <gml:Y>5</gml:Y> 435 </gml:coord> 436 <gml:coord> 437 <gml:X>6</gml:X> 438 <gml:Y>7</gml:Y> 439 </gml:coord> 440 <gml:coord> 441 <gml:X>2</gml:X> 442 <gml:Y>3</gml:Y> 443 </gml:coord> 444 </gml:LinearRing> 445 </gml:innerBoundaryIs> 446 <gml:innerBoundaryIs> 447 <gml:LinearRing> 448 <gml:coord> 449 <gml:X>3</gml:X> 450 <gml:Y>4</gml:Y> 451 </gml:coord> 452 <gml:coord> 453 <gml:X>5</gml:X> 454 <gml:Y>6</gml:Y> 455 </gml:coord> 456 <gml:coord> 457 <gml:X>7</gml:X> 458 <gml:Y>8</gml:Y> 459 </gml:coord> 460 <gml:coord> 461 <gml:X>3</gml:X> 462 <gml:Y>4</gml:Y> 463 </gml:coord> 464 </gml:LinearRing> 465 </gml:innerBoundaryIs> 466 </gml:Polygon> 467 </gml:polygonMember> 468 <gml:polygonMember> 469 <gml:Polygon> 470 <gml:outerBoundaryIs> 471 <gml:LinearRing> 472 <gml:coord> 473 <gml:X>1</gml:X> 474 <gml:Y>2</gml:Y> 475 </gml:coord> 476 <gml:coord> 477 <gml:X>3</gml:X> 478 <gml:Y>4</gml:Y> 479 </gml:coord> 480 <gml:coord> 481 <gml:X>5</gml:X> 482 <gml:Y>6</gml:Y> 483 </gml:coord> 484 <gml:coord> 485 <gml:X>1</gml:X> 486 <gml:Y>2</gml:Y> 487 </gml:coord> 488 </gml:LinearRing> 489 </gml:outerBoundaryIs> 490 </gml:Polygon> 491 </gml:polygonMember> 492 </gml:MultiPolygon> 493 --></div> 494 <div id="v2/multipolygon-coordinates.xml"><!-- 495 <gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 496 <gml:polygonMember> 497 <gml:Polygon> 498 <gml:outerBoundaryIs> 499 <gml:LinearRing> 500 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates> 501 </gml:LinearRing> 502 </gml:outerBoundaryIs> 503 <gml:innerBoundaryIs> 504 <gml:LinearRing> 505 <gml:coordinates decimal="." cs="," ts=" ">2,3 4,5 6,7 2,3</gml:coordinates> 506 </gml:LinearRing> 507 </gml:innerBoundaryIs> 508 <gml:innerBoundaryIs> 509 <gml:LinearRing> 510 <gml:coordinates decimal="." cs="," ts=" ">3,4 5,6 7,8 3,4</gml:coordinates> 511 </gml:LinearRing> 512 </gml:innerBoundaryIs> 513 </gml:Polygon> 514 </gml:polygonMember> 515 <gml:polygonMember> 516 <gml:Polygon> 517 <gml:outerBoundaryIs> 518 <gml:LinearRing> 519 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates> 520 </gml:LinearRing> 521 </gml:outerBoundaryIs> 522 </gml:Polygon> 523 </gml:polygonMember> 524 </gml:MultiPolygon> 525 --></div> 526 <div id="v2/geometrycollection-coordinates.xml"><!-- 527 <gml:GeometryCollection xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 528 <gml:geometryMember> 529 <gml:Point srsName="foo"> 530 <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates> 531 </gml:Point> 532 </gml:geometryMember> 533 <gml:geometryMember> 534 <gml:LineString srsName="foo"> 535 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4</gml:coordinates> 536 </gml:LineString> 537 </gml:geometryMember> 538 <gml:geometryMember> 539 <gml:Polygon srsName="foo"> 540 <gml:outerBoundaryIs> 541 <gml:LinearRing> 542 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates> 543 </gml:LinearRing> 544 </gml:outerBoundaryIs> 545 <gml:innerBoundaryIs> 546 <gml:LinearRing> 547 <gml:coordinates decimal="." cs="," ts=" ">2,3 4,5 6,7 2,3</gml:coordinates> 548 </gml:LinearRing> 549 </gml:innerBoundaryIs> 550 <gml:innerBoundaryIs> 551 <gml:LinearRing> 552 <gml:coordinates decimal="." cs="," ts=" ">3,4 5,6 7,8 3,4</gml:coordinates> 553 </gml:LinearRing> 554 </gml:innerBoundaryIs> 555 </gml:Polygon> 556 </gml:geometryMember> 557 </gml:GeometryCollection> 558 --></div> 559 <div id="v2/box-coord.xml"><!-- 560 <gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 561 <gml:coord> 562 <gml:X>1</gml:X> 563 <gml:Y>2</gml:Y> 564 </gml:coord> 565 <gml:coord> 566 <gml:X>3</gml:X> 567 <gml:Y>4</gml:Y> 568 </gml:coord> 569 </gml:Box> 570 --></div> 571 <div id="v2/box-coordinates.xml"><!-- 572 <gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 573 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4</gml:coordinates> 574 </gml:Box> 575 --></div> 576 <div id="v2/linearring-coord.xml"><!-- 577 <gml:LinearRing xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 578 <gml:coord> 579 <gml:X>1</gml:X> 580 <gml:Y>2</gml:Y> 581 </gml:coord> 582 <gml:coord> 583 <gml:X>3</gml:X> 584 <gml:Y>4</gml:Y> 585 </gml:coord> 586 <gml:coord> 587 <gml:X>5</gml:X> 588 <gml:Y>6</gml:Y> 589 </gml:coord> 590 <gml:coord> 591 <gml:X>1</gml:X> 592 <gml:Y>2</gml:Y> 593 </gml:coord> 594 </gml:LinearRing> 595 --></div> 596 <div id="v2/linearring-coordinates.xml"><!-- 597 <gml:LinearRing xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 598 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates> 599 </gml:LinearRing> 600 --></div> 601 <div id="v2/topp-states.xml"><!-- 602 <?xml version="1.0" encoding="UTF-8"?><wfs:FeatureCollection xmlns="http://www.opengis.net/wfs" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openplans.org/topp http://sigma.openplans.org:80/geoserver/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=topp:states http://www.opengis.net/wfs http://sigma.openplans.org:80/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd"><gml:featureMember><topp:states fid="states.1"><topp:the_geom><gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">37.51099,-88.071564 37.476273,-88.087883 37.442852,-88.311707 37.409309,-88.359177 37.420292,-88.419853 37.400757,-88.467644 37.296852,-88.511322 37.257782,-88.501427 37.205669,-88.450699 37.15691,-88.422516 37.098671,-88.45047 37.072144,-88.476799 37.06818,-88.4907 37.06477,-88.517273 37.072815,-88.559273 37.109047,-88.61422 37.13541,-88.68837 37.141182,-88.739113 37.152107,-88.746506 37.202194,-88.863289 37.218407,-88.932503 37.220036,-88.993172 37.18586,-89.065033 37.112137,-89.116821 37.093185,-89.146347 37.064236,-89.169548 37.025711,-89.174332 36.99844,-89.150246 36.988113,-89.12986 36.986771,-89.193512 37.028973,-89.210052 37.041733,-89.237679 37.087124,-89.264053 37.091244,-89.284233 37.085384,-89.303291 37.060909,-89.3097 37.027733,-89.264244 37.008686,-89.262001 36.999207,-89.282768 37.009682,-89.310982 37.049213,-89.38295 37.099083,-89.37999 37.137203,-89.423798 37.165318,-89.440521 37.224266,-89.468216 37.253731,-89.465309 37.256001,-89.489594 37.276402,-89.513885 37.304962,-89.513885 37.329441,-89.50058 37.339409,-89.468742 37.355717,-89.435738 37.411018,-89.427574 37.453186,-89.453621 37.491726,-89.494781 37.571957,-89.524971 37.615929,-89.513367 37.650375,-89.51918 37.67984,-89.513374 37.694798,-89.521523 37.706104,-89.581436 37.745453,-89.666458 37.78397,-89.675858 37.804794,-89.691055 37.840992,-89.728447 37.905064,-89.851715 37.905487,-89.861046 37.891876,-89.866814 37.875904,-89.900551 37.878044,-89.937874 37.911884,-89.978912 37.963634,-89.958229 37.969318,-90.010811 37.993206,-90.041924 38.032272,-90.119339 38.053951,-90.134712 38.088905,-90.207527 38.122169,-90.254059 38.166817,-90.289635 38.188713,-90.336716 38.234299,-90.364769 38.323559,-90.369347 38.36533,-90.358688 38.390846,-90.339607 38.427357,-90.301842 38.518688,-90.265785 38.532768,-90.26123 38.562805,-90.240944 38.610271,-90.183708 38.658772,-90.183578 38.700363,-90.20224 38.723965,-90.196571 38.773098,-90.163399 38.785484,-90.135178 38.80051,-90.121727 38.830467,-90.113121 38.853031,-90.132812 38.914509,-90.243927 38.924717,-90.278931 38.924908,-90.31974 38.96233,-90.413071 38.959179,-90.469841 38.891609,-90.530426 38.871326,-90.570328 38.880795,-90.627213 38.935253,-90.668877 39.037792,-90.70607 39.058178,-90.707588 39.0937,-90.690399 39.144211,-90.716736 39.195873,-90.718193 39.224747,-90.732338 39.24781,-90.738083 39.296803,-90.779343 39.350452,-90.850494 39.400585,-90.947891 39.444412,-91.036339 39.473984,-91.064384 39.528927,-91.093613 39.552593,-91.156189 39.600021,-91.203247 39.685917,-91.317665 39.72464,-91.367088 39.761272,-91.373421 39.803772,-91.381714 39.863049,-91.449188 39.885242,-91.450989 39.901829,-91.434052 39.921837,-91.430389 39.946064,-91.447243 40.005753,-91.487289 40.066711,-91.504005 40.134544,-91.516129 40.200459,-91.506546 40.251377,-91.498932 40.309624,-91.486694 40.371902,-91.448593 40.386875,-91.418816 40.392361,-91.385757 40.402988,-91.372757 40.44725,-91.385399 40.503654,-91.374794 40.528496,-91.382103 40.547993,-91.412872 40.572971,-91.411118 40.603439,-91.37561 40.639545,-91.262062 40.643818,-91.214912 40.656311,-91.162498 40.682148,-91.129158 40.705402,-91.119987 40.761547,-91.092751 40.833729,-91.088905 40.879585,-91.04921 40.923927,-90.983276 40.950504,-90.960709 41.070362,-90.954651 41.104359,-90.957787 41.144371,-90.990341 41.165825,-91.018257 41.176258,-91.05632 41.231522,-91.101524 41.267818,-91.102348 41.334896,-91.07328 41.401379,-91.055786 41.423508,-91.027489 41.431084,-91.000694 41.421234,-90.949654 41.444622,-90.844139 41.449821,-90.7799 41.450062,-90.708214 41.462318,-90.658791 41.509586,-90.6007 41.52597,-90.54084 41.527546,-90.454994 41.543579,-90.434967 41.567272,-90.423004 41.586849,-90.348366 41.602798,-90.339348 41.64909,-90.341133 41.722736,-90.326027 41.756466,-90.304886 41.781738,-90.25531 41.806137,-90.195839 41.930775,-90.154518 41.983963,-90.14267 42.033428,-90.150536 42.061043,-90.168098 42.103745,-90.166649 42.120502,-90.176086 42.122688,-90.191574 42.159721,-90.230934 42.197319,-90.323601 42.210209,-90.367729 42.242645,-90.407173 42.263924,-90.417984 42.340633,-90.427681 42.360073,-90.441597 42.388783,-90.491043 42.421837,-90.563583 42.46056,-90.605827 42.475643,-90.648346 42.494698,-90.651772 42.509361,-90.638329 42.508362,-90.419975 42.504108,-89.923569 42.50346,-89.834618 42.49749,-89.400497 42.497906,-89.359444 42.490864,-88.939079 42.490906,-88.764954 42.489655,-88.70652 42.49197,-88.297897 42.489613,-88.194702 42.489132,-87.79731 42.314213,-87.836945 42.156456,-87.760239 42.059822,-87.670547 41.847332,-87.612625 41.723591,-87.529861 41.469715,-87.532646 41.301304,-87.532448 41.173756,-87.531731 41.00993,-87.532021 40.745411,-87.532669 40.49461,-87.53717 40.483246,-87.535675 40.166195,-87.535339 39.887302,-87.535774 39.609341,-87.535576 39.477448,-87.538567 39.350525,-87.540215 39.338268,-87.597664 39.307404,-87.625237 39.297661,-87.610619 39.281418,-87.615799 39.258163,-87.606895 39.248753,-87.584564 39.208466,-87.588593 39.198128,-87.594208 39.196068,-87.607925 39.168507,-87.644257 39.146679,-87.670326 39.130653,-87.659454 39.113468,-87.662262 39.103943,-87.631668 39.088974,-87.630867 39.084606,-87.612007 39.062435,-87.58532 38.995743,-87.581749 38.994083,-87.591858 38.977077,-87.547905 38.963703,-87.53347 38.931919,-87.530182 38.904861,-87.5392 38.869812,-87.559059 38.857891,-87.550507 38.795559,-87.507889 38.776699,-87.519028 38.769722,-87.508003 38.736633,-87.508316 38.685974,-87.543892 38.672169,-87.588478 38.642811,-87.625191 38.622917,-87.628647 38.599209,-87.619827 38.593178,-87.640594 38.573872,-87.652855 38.547424,-87.672943 38.515369,-87.65139 38.500443,-87.653534 38.504005,-87.679909 38.481533,-87.692818 38.466125,-87.756096 38.457096,-87.758659 38.44548,-87.738953 38.417965,-87.748428 38.378124,-87.784019 38.352524,-87.834503 38.286098,-87.850082 38.285362,-87.863007 38.316788,-87.874039 38.315552,-87.883446 38.300659,-87.888466 38.281048,-87.914108 38.302345,-87.913651 38.304771,-87.925919 38.241085,-87.980019 38.234814,-87.986008 38.200714,-87.977928 38.171131,-87.932289 38.157528,-87.931992 38.136913,-87.950569 38.13176,-87.973503 38.103302,-88.018547 38.092346,-88.012329 38.096748,-87.964867 38.073307,-87.975296 38.054085,-88.034729 38.04512,-88.043091 38.038303,-88.041473 38.033531,-88.021698 38.008236,-88.029213 37.975056,-88.021706 37.956264,-88.042511 37.934498,-88.041771 37.929783,-88.064621 37.944,-88.078941 37.92366,-88.084 37.917591,-88.030441 37.905758,-88.026588 37.896004,-88.044868 37.90617,-88.100082 37.895306,-88.101456 37.867809,-88.075737 37.843746,-88.034241 37.827522,-88.042137 37.831249,-88.089264 37.817612,-88.086029 37.805683,-88.035576 37.735401,-88.072472 37.700745,-88.133636 37.660686,-88.15937 37.628479,-88.157631 37.583572,-88.134171 37.51099,-88.071564</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom><topp:STATE_NAME>Illinois</topp:STATE_NAME><topp:STATE_FIPS>17</topp:STATE_FIPS><topp:SUB_REGION>E N Cen</topp:SUB_REGION><topp:STATE_ABBR>IL</topp:STATE_ABBR><topp:LAND_KM>143986.61</topp:LAND_KM><topp:WATER_KM>1993.335</topp:WATER_KM><topp:PERSONS>1.1430602E7</topp:PERSONS><topp:FAMILIES>2924880.0</topp:FAMILIES><topp:HOUSHOLD>4202240.0</topp:HOUSHOLD><topp:MALE>5552233.0</topp:MALE><topp:FEMALE>5878369.0</topp:FEMALE><topp:WORKERS>4199206.0</topp:WORKERS><topp:DRVALONE>3741715.0</topp:DRVALONE><topp:CARPOOL>652603.0</topp:CARPOOL><topp:PUBTRANS>538071.0</topp:PUBTRANS><topp:EMPLOYED>5417967.0</topp:EMPLOYED><topp:UNEMPLOY>385040.0</topp:UNEMPLOY><topp:SERVICE>1360159.0</topp:SERVICE><topp:MANUAL>828906.0</topp:MANUAL><topp:P_MALE>0.486</topp:P_MALE><topp:P_FEMALE>0.514</topp:P_FEMALE><topp:SAMP_POP>1747776.0</topp:SAMP_POP></topp:states></gml:featureMember><gml:featureMember><topp:states fid="states.2"><topp:the_geom><gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">38.966557,-77.008232 38.889988,-76.911209 38.78812,-77.045448 38.813915,-77.035248 38.829365,-77.045189 38.838413,-77.040405 38.862431,-77.039078 38.886101,-77.067886 38.9156,-77.078949 38.93206,-77.122627 38.993431,-77.042389 38.966557,-77.008232</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom><topp:STATE_NAME>District of Columbia</topp:STATE_NAME><topp:STATE_FIPS>11</topp:STATE_FIPS><topp:SUB_REGION>S Atl</topp:SUB_REGION><topp:STATE_ABBR>DC</topp:STATE_ABBR><topp:LAND_KM>159.055</topp:LAND_KM><topp:WATER_KM>17.991</topp:WATER_KM><topp:PERSONS>606900.0</topp:PERSONS><topp:FAMILIES>122087.0</topp:FAMILIES><topp:HOUSHOLD>249634.0</topp:HOUSHOLD><topp:MALE>282970.0</topp:MALE><topp:FEMALE>323930.0</topp:FEMALE><topp:WORKERS>229975.0</topp:WORKERS><topp:DRVALONE>106694.0</topp:DRVALONE><topp:CARPOOL>36621.0</topp:CARPOOL><topp:PUBTRANS>111422.0</topp:PUBTRANS><topp:EMPLOYED>303994.0</topp:EMPLOYED><topp:UNEMPLOY>23442.0</topp:UNEMPLOY><topp:SERVICE>65498.0</topp:SERVICE><topp:MANUAL>22407.0</topp:MANUAL><topp:P_MALE>0.466</topp:P_MALE><topp:P_FEMALE>0.534</topp:P_FEMALE><topp:SAMP_POP>72696.0</topp:SAMP_POP></topp:states></gml:featureMember><gml:featureMember><topp:states fid="states.3"><topp:the_geom><gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">38.557476,-75.70742 38.649551,-75.71106 38.83017,-75.724937 39.141548,-75.752922 39.247753,-75.761658 39.295849,-75.764664 39.383007,-75.772697 39.723755,-75.791435 39.724442,-75.775269 39.774818,-75.745934 39.820347,-75.695114 39.838196,-75.644341 39.840008,-75.583794 39.826435,-75.470345 39.79887,-75.42083 39.789658,-75.412117 39.77813,-75.428009 39.763248,-75.460754 39.741718,-75.475128 39.719971,-75.476334 39.714745,-75.489639 39.612793,-75.610725 39.566723,-75.562996 39.463768,-75.590187 39.36694,-75.515572 39.257637,-75.402481 39.073036,-75.397728 39.012386,-75.324852 38.945911,-75.307899 38.80867,-75.190941 38.799812,-75.083138 38.44949,-75.045998 38.449963,-75.068298 38.450451,-75.093094 38.455208,-75.350204 38.463066,-75.69915 38.557476,-75.70742</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom><topp:STATE_NAME>Delaware</topp:STATE_NAME><topp:STATE_FIPS>10</topp:STATE_FIPS><topp:SUB_REGION>S Atl</topp:SUB_REGION><topp:STATE_ABBR>DE</topp:STATE_ABBR><topp:LAND_KM>5062.456</topp:LAND_KM><topp:WATER_KM>1385.022</topp:WATER_KM><topp:PERSONS>666168.0</topp:PERSONS><topp:FAMILIES>175867.0</topp:FAMILIES><topp:HOUSHOLD>247497.0</topp:HOUSHOLD><topp:MALE>322968.0</topp:MALE><topp:FEMALE>343200.0</topp:FEMALE><topp:WORKERS>247566.0</topp:WORKERS><topp:DRVALONE>258087.0</topp:DRVALONE><topp:CARPOOL>42968.0</topp:CARPOOL><topp:PUBTRANS>8069.0</topp:PUBTRANS><topp:EMPLOYED>335147.0</topp:EMPLOYED><topp:UNEMPLOY>13945.0</topp:UNEMPLOY><topp:SERVICE>87973.0</topp:SERVICE><topp:MANUAL>44140.0</topp:MANUAL><topp:P_MALE>0.485</topp:P_MALE><topp:P_FEMALE>0.515</topp:P_FEMALE><topp:SAMP_POP>102776.0</topp:SAMP_POP></topp:states></gml:featureMember></wfs:FeatureCollection> 603 --></div> 604 </body> 605 </html> -
tests/Format/GML/v3.html
old new 1 <html> 2 <head> 3 <script src="../../../lib/OpenLayers.js"></script> 4 <script src="cases.js"></script> 5 <script type="text/javascript"> 6 7 function test_readNode_geometry(t) { 8 var files = [ 9 "v2/point-coord.xml", "v2/point-coordinates.xml", 10 "v2/linestring-coord.xml", "v2/linestring-coordinates.xml", 11 "v2/multipoint-coord.xml", "v2/multipoint-coordinates.xml", 12 "v2/multilinestring-coord.xml", "v2/multilinestring-coordinates.xml", 13 "v3/point.xml", "v3/linestring.xml", "v3/polygon.xml", 14 "v3/multipoint-singular.xml", "v3/multipoint-plural.xml", 15 "v3/multilinestring-singular.xml", "v3/multilinestring-plural.xml", 16 "v3/multipolygon-singular.xml", "v3/multipolygon-plural.xml", 17 "v3/multisurface-singular.xml", "v3/multisurface-plural.xml" 18 ]; 19 20 var len = files.length; 21 t.plan(len); 22 23 var format = new OpenLayers.Format.GML.v3({ 24 featureType: "feature", 25 featureNS: "http://example.com/feature" 26 }); 27 var file, doc, expect, out; 28 for(var i=0; i<len; ++i) { 29 file = files[i]; 30 expect = cases[file]; 31 if(expect) { 32 doc = readXML(file); 33 if(doc && doc.documentElement) { 34 out = format.readNode(doc.documentElement); 35 if(out.components && out.components.length == 1) { 36 t.geom_eq(out.components[0], expect, "[" + file + "] geometry read"); 37 } else { 38 t.fail("[" + file + "] gml parsing"); 39 } 40 } else { 41 t.fail("[" + file + "] xml parsing"); 42 } 43 } else { 44 t.fail("[" + file + "] case not found"); 45 } 46 } 47 48 } 49 50 function test_readNode_bounds(t) { 51 var files = ["v3/envelope.xml"]; 52 53 var len = files.length; 54 t.plan(len); 55 56 var file, doc, expect, got; 57 var format = new OpenLayers.Format.GML.v3({ 58 featureType: "feature", 59 featureNS: "http://example.com/feature" 60 }); 61 for(var i=0; i<len; ++i) { 62 file = files[i]; 63 expect = cases[file]; 64 if(expect) { 65 doc = readXML(file); 66 if(doc && doc.documentElement) { 67 out = format.readNode(doc.documentElement); 68 if(out.components && out.components.length == 1) { 69 got = out.components[0]; 70 if(got instanceof OpenLayers.Bounds) { 71 t.ok(out.components[0].equals(expect), "[" + file + "] bounds read") 72 } else { 73 t.fail("[" + file + "] expected a bounds, got " + got); 74 } 75 } else { 76 t.fail("[" + file + "] gml parsing"); 77 } 78 } else { 79 t.fail("[" + file + "] xml parsing"); 80 } 81 } else { 82 t.fail("[" + file + "] case not found"); 83 } 84 } 85 86 } 87 88 function test_writeNode_geometry(t) { 89 // we only care to write the 'pos' and 'posList' variants of GML 3 - conforming with simple features profile 90 var files = [ 91 "v3/point.xml", 92 "v3/linestring.xml", 93 "v3/polygon.xml", 94 "v3/multipoint-singular.xml", 95 "v3/multilinestring-singular.xml", 96 "v3/multipolygon-singular.xml" 97 ]; 98 99 var len = files.length; 100 t.plan(len); 101 102 var format = new OpenLayers.Format.GML.v3({ 103 featureType: "feature", 104 featureNS: "http://example.com/feature", 105 srsName: "foo" // GML geometry collections require srsName, we only write if provided 106 }); 107 var file, geom, doc, node; 108 for(var i=0; i<len; ++i) { 109 file = files[i]; 110 geom = cases[file]; 111 if(geom) { 112 doc = readXML(file); 113 if(doc && doc.documentElement) { 114 node = format.writeNode("feature:_geometry", geom); 115 t.xml_eq(node.firstChild, doc.documentElement, "[" + file + "] geometry written"); 116 } else { 117 t.fail("[" + file + "] xml parsing"); 118 } 119 } else { 120 t.fail("[" + file + "] case not found"); 121 } 122 } 123 } 124 125 function test_writeNode_bounds(t) { 126 // we only care to write the 'coordinates' variant of GML 2 127 var files = [ 128 "v3/envelope.xml" 129 ]; 130 131 var len = files.length; 132 t.plan(len); 133 134 var format = new OpenLayers.Format.GML.v3({ 135 featureType: "feature", 136 featureNS: "http://example.com/feature", 137 srsName: "foo" // GML envelopes require srsName, we only write if provided 138 }); 139 var file, bounds, doc, node; 140 for(var i=0; i<len; ++i) { 141 file = files[i]; 142 bounds = cases[file]; 143 if(bounds) { 144 doc = readXML(file); 145 if(doc && doc.documentElement) { 146 node = format.writeNode("gml:Envelope", bounds); 147 t.xml_eq(node, doc.documentElement, "[" + file + "] bounds written"); 148 } else { 149 t.fail("[" + file + "] xml parsing"); 150 } 151 } else { 152 t.fail("[" + file + "] case not found"); 153 } 154 } 155 } 156 157 function test_read(t) { 158 t.plan(8); 159 var doc = readXML("v3/topp-states-wfs.xml"); 160 var format = new OpenLayers.Format.GML.v3({ 161 featureType: "states", 162 featureNS: "http://www.openplans.org/topp", 163 geometryName: "the_geom" 164 }); 165 var features = format.read(doc.documentElement); 166 167 t.eq(features.length, 3, "read 3 features"); 168 var feature = features[0]; 169 t.eq(feature.fid, "states.1", "read fid"); 170 t.eq(feature.geometry.CLASS_NAME, "OpenLayers.Geometry.MultiPolygon", 171 "read multipolygon geometry"); 172 var attributes = feature.attributes; 173 t.eq(attributes["STATE_NAME"], "Illinois", "read STATE_NAME"); 174 t.eq(attributes["STATE_FIPS"], "17", "read STATE_FIPS"); 175 t.eq(attributes["SUB_REGION"], "E N Cen", "read SUB_REGION"); 176 t.eq(attributes["STATE_ABBR"], "IL", "read STATE_ABBR"); 177 t.eq(attributes["LAND_KM"], "143986.61", "read LAND_KM"); 178 } 179 180 function test_write(t) { 181 t.plan(1); 182 var doc = readXML("v3/topp-states-gml.xml"); 183 var format = new OpenLayers.Format.GML.v3({ 184 featureType: "states", 185 featureNS: "http://www.openplans.org/topp", 186 geometryName: "the_geom", 187 srsName: "urn:x-ogc:def:crs:EPSG:4326", 188 schemaLocation: "http://www.openplans.org/topp http://sigma.openplans.org:80/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:states http://www.opengis.net/gml http://schemas.opengis.net/gml/3.2.1/gml.xsd" 189 }); 190 var features = format.read(doc.documentElement); 191 192 var got = format.write(features); 193 t.xml_eq(got, doc.documentElement, "gml:featureMembers round trip"); 194 } 195 196 </script> 197 </head> 198 <body> 199 <div id="v3/envelope.xml"><!-- 200 <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 201 <gml:lowerCorner><gml:pos>1 2</gml:pos></gml:lowerCorner> 202 <gml:upperCorner><gml:pos>3 4</gml:pos></gml:upperCorner> 203 </gml:Envelope> 204 --></div> 205 <div id="v3/linearring.xml"><!-- 206 <gml:LinearRing xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 207 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 208 </gml:LinearRing> 209 --></div> 210 <div id="v3/linestring.xml"><!-- 211 <gml:LineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 212 <gml:posList>1 2 3 4</gml:posList> 213 </gml:LineString> 214 --></div> 215 <div id="v3/multilinestring-plural.xml"><!-- 216 <gml:MultiLineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 217 <gml:lineStringMembers> 218 <gml:LineString> 219 <gml:posList>1 2 2 3</gml:posList> 220 </gml:LineString> 221 <gml:LineString> 222 <gml:posList>3 4 4 5</gml:posList> 223 </gml:LineString> 224 </gml:lineStringMembers> 225 </gml:MultiLineString> 226 --></div> 227 <div id="v3/multilinestring-singular.xml"><!-- 228 <gml:MultiLineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 229 <gml:lineStringMember> 230 <gml:LineString> 231 <gml:posList>1 2 2 3</gml:posList> 232 </gml:LineString> 233 </gml:lineStringMember> 234 <gml:lineStringMember> 235 <gml:LineString> 236 <gml:posList>3 4 4 5</gml:posList> 237 </gml:LineString> 238 </gml:lineStringMember> 239 </gml:MultiLineString> 240 --></div> 241 <div id="v3/multipoint-plural.xml"><!-- 242 <gml:MultiPoint xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 243 <gml:pointMembers> 244 <gml:Point> 245 <gml:pos>1 2</gml:pos> 246 </gml:Point> 247 <gml:Point> 248 <gml:pos>2 3</gml:pos> 249 </gml:Point> 250 <gml:Point> 251 <gml:pos>3 4</gml:pos> 252 </gml:Point> 253 </gml:pointMembers> 254 </gml:MultiPoint> 255 --></div> 256 <div id="v3/multipoint-singular.xml"><!-- 257 <gml:MultiPoint xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 258 <gml:pointMember> 259 <gml:Point> 260 <gml:pos>1 2</gml:pos> 261 </gml:Point> 262 </gml:pointMember> 263 <gml:pointMember> 264 <gml:Point> 265 <gml:pos>2 3</gml:pos> 266 </gml:Point> 267 </gml:pointMember> 268 <gml:pointMember> 269 <gml:Point> 270 <gml:pos>3 4</gml:pos> 271 </gml:Point> 272 </gml:pointMember> 273 </gml:MultiPoint> 274 --></div> 275 <div id="v3/multipolygon-plural.xml"><!-- 276 <gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 277 <gml:polygonMembers> 278 <gml:Polygon> 279 <gml:exterior> 280 <gml:LinearRing> 281 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 282 </gml:LinearRing> 283 </gml:exterior> 284 <gml:interior> 285 <gml:LinearRing> 286 <gml:posList>2 3 4 5 6 7 2 3</gml:posList> 287 </gml:LinearRing> 288 </gml:interior> 289 <gml:interior> 290 <gml:LinearRing> 291 <gml:posList>3 4 5 6 7 8 3 4</gml:posList> 292 </gml:LinearRing> 293 </gml:interior> 294 </gml:Polygon> 295 <gml:Polygon> 296 <gml:exterior> 297 <gml:LinearRing> 298 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 299 </gml:LinearRing> 300 </gml:exterior> 301 </gml:Polygon> 302 </gml:polygonMembers> 303 </gml:MultiPolygon> 304 --></div> 305 <div id="v3/multipolygon-singular.xml"><!-- 306 <gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 307 <gml:polygonMember> 308 <gml:Polygon> 309 <gml:exterior> 310 <gml:LinearRing> 311 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 312 </gml:LinearRing> 313 </gml:exterior> 314 <gml:interior> 315 <gml:LinearRing> 316 <gml:posList>2 3 4 5 6 7 2 3</gml:posList> 317 </gml:LinearRing> 318 </gml:interior> 319 <gml:interior> 320 <gml:LinearRing> 321 <gml:posList>3 4 5 6 7 8 3 4</gml:posList> 322 </gml:LinearRing> 323 </gml:interior> 324 </gml:Polygon> 325 </gml:polygonMember> 326 <gml:polygonMember> 327 <gml:Polygon> 328 <gml:exterior> 329 <gml:LinearRing> 330 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 331 </gml:LinearRing> 332 </gml:exterior> 333 </gml:Polygon> 334 </gml:polygonMember> 335 </gml:MultiPolygon> 336 --></div> 337 <div id="v3/multisurface-plural.xml"><!-- 338 <gml:MultiSurface xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 339 <gml:surfaceMembers> 340 <gml:Polygon> 341 <gml:exterior> 342 <gml:LinearRing> 343 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 344 </gml:LinearRing> 345 </gml:exterior> 346 <gml:interior> 347 <gml:LinearRing> 348 <gml:posList>2 3 4 5 6 7 2 3</gml:posList> 349 </gml:LinearRing> 350 </gml:interior> 351 <gml:interior> 352 <gml:LinearRing> 353 <gml:posList>3 4 5 6 7 8 3 4</gml:posList> 354 </gml:LinearRing> 355 </gml:interior> 356 </gml:Polygon> 357 <gml:Polygon> 358 <gml:exterior> 359 <gml:LinearRing> 360 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 361 </gml:LinearRing> 362 </gml:exterior> 363 </gml:Polygon> 364 </gml:surfaceMembers> 365 </gml:MultiSurface> 366 --></div> 367 <div id="v3/multisurface-singular.xml"><!-- 368 <gml:MultiSurface xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 369 <gml:surfaceMember> 370 <gml:Polygon> 371 <gml:exterior> 372 <gml:LinearRing> 373 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 374 </gml:LinearRing> 375 </gml:exterior> 376 <gml:interior> 377 <gml:LinearRing> 378 <gml:posList>2 3 4 5 6 7 2 3</gml:posList> 379 </gml:LinearRing> 380 </gml:interior> 381 <gml:interior> 382 <gml:LinearRing> 383 <gml:posList>3 4 5 6 7 8 3 4</gml:posList> 384 </gml:LinearRing> 385 </gml:interior> 386 </gml:Polygon> 387 </gml:surfaceMember> 388 <gml:surfaceMember> 389 <gml:Polygon> 390 <gml:exterior> 391 <gml:LinearRing> 392 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 393 </gml:LinearRing> 394 </gml:exterior> 395 </gml:Polygon> 396 </gml:surfaceMember> 397 </gml:MultiSurface> 398 --></div> 399 <div id="v3/point.xml"><!-- 400 <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 401 <gml:pos>1 2</gml:pos> 402 </gml:Point> 403 --></div> 404 <div id="v3/polygon.xml"><!-- 405 <gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 406 <gml:exterior> 407 <gml:LinearRing> 408 <gml:posList>1 2 3 4 5 6 1 2</gml:posList> 409 </gml:LinearRing> 410 </gml:exterior> 411 <gml:interior> 412 <gml:LinearRing> 413 <gml:posList>2 3 4 5 6 7 2 3</gml:posList> 414 </gml:LinearRing> 415 </gml:interior> 416 <gml:interior> 417 <gml:LinearRing> 418 <gml:posList>3 4 5 6 7 8 3 4</gml:posList> 419 </gml:LinearRing> 420 </gml:interior> 421 </gml:Polygon> 422 --></div> 423 <div id="v3/topp-states-gml.xml"><!-- 424 <?xml version="1.0" encoding="UTF-8"?> 425 <gml:featureMembers xsi:schemaLocation="http://www.openplans.org/topp http://sigma.openplans.org:80/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:states http://www.opengis.net/gml http://schemas.opengis.net/gml/3.2.1/gml.xsd" xmlns:topp="http://www.openplans.org/topp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml"><topp:states fid="states.1"><topp:the_geom><gml:MultiPolygon srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:polygonMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>37.511 -88.071 37.476 -88.087 37.442 -88.311 37.409 -88.359 37.421 -88.419 37.401 -88.467 37.296 -88.511 37.257 -88.501 37.205 -88.451 37.156 -88.422 37.098 -88.451 37.072 -88.476 37.068 -88.491 37.064 -88.517 37.072 -88.559 37.109 -88.614 37.135 -88.688 37.141 -88.739 37.152 -88.746 37.202 -88.863 37.218 -88.932 37.221 -88.993 37.185 -89.065 37.112 -89.116 37.093 -89.146 37.064 -89.169 37.025 -89.174 36.998 -89.151 36.988 -89.129 36.986 -89.193 37.028 -89.211 37.041 -89.237 37.087 -89.264 37.091 -89.284 37.085 -89.303 37.061 -89.309 37.027 -89.264 37.008 -89.262 36.999 -89.282 37.009 -89.311 37.049 -89.382 37.099 -89.379 37.137 -89.423 37.165 -89.441 37.224 -89.468 37.253 -89.465 37.256 -89.489 37.276 -89.513 37.304 -89.513 37.329 -89.501 37.339 -89.468 37.355 -89.435 37.411 -89.427 37.453 -89.453 37.491 -89.494 37.571 -89.524 37.615 -89.513 37.651 -89.519 37.679 -89.513 37.694 -89.521 37.706 -89.581 37.745 -89.666 37.783 -89.675 37.804 -89.691 37.841 -89.728 37.905 -89.851 37.905 -89.861 37.891 -89.866 37.875 -89.901 37.878 -89.937 37.911 -89.978 37.963 -89.958 37.969 -90.011 37.993 -90.041 38.032 -90.119 38.053 -90.134 38.088 -90.207 38.122 -90.254 38.166 -90.289 38.188 -90.336 38.234 -90.364 38.323 -90.369 38.365 -90.358 38.391 -90.339 38.427 -90.301 38.518 -90.265 38.532 -90.261 38.562 -90.241 38.611 -90.183 38.658 -90.183 38.701 -90.202 38.723 -90.196 38.773 -90.163 38.785 -90.135 38.801 -90.121 38.831 -90.113 38.853 -90.132 38.914 -90.243 38.924 -90.278 38.924 -90.319 38.962 -90.413 38.959 -90.469 38.891 -90.531 38.871 -90.571 38.881 -90.627 38.935 -90.668 39.037 -90.706 39.058 -90.707 39.093 -90.691 39.144 -90.716 39.195 -90.718 39.224 -90.732 39.247 -90.738 39.296 -90.779 39.351 -90.851 39.401 -90.947 39.444 -91.036 39.473 -91.064 39.528 -91.093 39.552 -91.156 39.601 -91.203 39.685 -91.317 39.724 -91.367 39.761 -91.373 39.803 -91.381 39.863 -91.449 39.885 -91.451 39.901 -91.434 39.921 -91.431 39.946 -91.447 40.005 -91.487 40.066 -91.504 40.134 -91.516 40.201 -91.506 40.251 -91.498 40.309 -91.486 40.371 -91.448 40.386 -91.418 40.392 -91.385 40.402 -91.372 40.447 -91.385 40.503 -91.374 40.528 -91.382 40.547 -91.412 40.572 -91.411 40.603 -91.375 40.639 -91.262 40.643 -91.214 40.656 -91.162 40.682 -91.129 40.705 -91.119 40.761 -91.092 40.833 -91.088 40.879 -91.049 40.923 -90.983 40.951 -90.961 41.071 -90.954 41.104 -90.957 41.144 -90.991 41.165 -91.018 41.176 -91.056 41.231 -91.101 41.267 -91.102 41.334 -91.073 41.401 -91.055 41.423 -91.027 41.431 -91.001 41.421 -90.949 41.444 -90.844 41.449 -90.779 41.451 -90.708 41.462 -90.658 41.509 -90.601 41.525 -90.541 41.527 -90.454 41.543 -90.434 41.567 -90.423 41.586 -90.348 41.602 -90.339 41.649 -90.341 41.722 -90.326 41.756 -90.304 41.781 -90.255 41.806 -90.195 41.931 -90.154 41.983 -90.142 42.033 -90.151 42.061 -90.168 42.103 -90.166 42.121 -90.176 42.122 -90.191 42.159 -90.231 42.197 -90.323 42.211 -90.367 42.242 -90.407 42.263 -90.417 42.341 -90.427 42.361 -90.441 42.388 -90.491 42.421 -90.563 42.461 -90.605 42.475 -90.648 42.494 -90.651 42.509 -90.638 42.508 -90.419 42.504 -89.923 42.503 -89.834 42.497 -89.401 42.497 -89.359 42.491 -88.939 42.491 -88.764 42.489 -88.706 42.491 -88.297 42.489 -88.194 42.489 -87.797 42.314 -87.836 42.156 -87.761 42.059 -87.671 41.847 -87.612 41.723 -87.529 41.469 -87.532 41.301 -87.532 41.173 -87.531 41.009 -87.532 40.745 -87.532 40.494 -87.537 40.483 -87.535 40.166 -87.535 39.887 -87.535 39.609 -87.535 39.477 -87.538 39.351 -87.541 39.338 -87.597 39.307 -87.625 39.297 -87.611 39.281 -87.615 39.258 -87.606 39.248 -87.584 39.208 -87.588 39.198 -87.594 39.196 -87.607 39.168 -87.644 39.146 -87.671 39.131 -87.659 39.113 -87.662 39.103 -87.631 39.088 -87.631 39.084 -87.612 39.062 -87.585 38.995 -87.581 38.994 -87.591 38.977 -87.547 38.963 -87.533 38.931 -87.531 38.904 -87.539 38.869 -87.559 38.857 -87.551 38.795 -87.507 38.776 -87.519 38.769 -87.508 38.736 -87.508 38.685 -87.543 38.672 -87.588 38.642 -87.625 38.622 -87.628 38.599 -87.619 38.593 -87.641 38.573 -87.652 38.547 -87.672 38.515 -87.651 38.501 -87.653 38.504 -87.679 38.481 -87.692 38.466 -87.756 38.457 -87.758 38.445 -87.738 38.417 -87.748 38.378 -87.784 38.352 -87.834 38.286 -87.851 38.285 -87.863 38.316 -87.874 38.315 -87.883 38.301 -87.888 38.281 -87.914 38.302 -87.913 38.304 -87.925 38.241 -87.981 38.234 -87.986 38.201 -87.977 38.171 -87.932 38.157 -87.931 38.136 -87.951 38.131 -87.973 38.103 -88.018 38.092 -88.012 38.096 -87.964 38.073 -87.975 38.054 -88.034 38.045 -88.043 38.038 -88.041 38.033 -88.021 38.008 -88.029 37.975 -88.021 37.956 -88.042 37.934 -88.041 37.929 -88.064 37.944 -88.078 37.923 -88.084 37.917 -88.031 37.905 -88.026 37.896 -88.044 37.906 -88.101 37.895 -88.101 37.867 -88.075 37.843 -88.034 37.827 -88.042 37.831 -88.089 37.817 -88.086 37.805 -88.035 37.735 -88.072 37.701 -88.133 37.661 -88.159 37.628 -88.157 37.583 -88.134 37.511 -88.071</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom><topp:STATE_NAME>Illinois</topp:STATE_NAME><topp:STATE_FIPS>17</topp:STATE_FIPS><topp:SUB_REGION>E N Cen</topp:SUB_REGION><topp:STATE_ABBR>IL</topp:STATE_ABBR><topp:LAND_KM>143986.61</topp:LAND_KM><topp:WATER_KM>1993.335</topp:WATER_KM><topp:PERSONS>1.143E7</topp:PERSONS><topp:FAMILIES>2924880.0</topp:FAMILIES><topp:HOUSHOLD>4202240.0</topp:HOUSHOLD><topp:MALE>5552233.0</topp:MALE><topp:FEMALE>5878369.0</topp:FEMALE><topp:WORKERS>4199206.0</topp:WORKERS><topp:DRVALONE>3741715.0</topp:DRVALONE><topp:CARPOOL>652603.0</topp:CARPOOL><topp:PUBTRANS>538071.0</topp:PUBTRANS><topp:EMPLOYED>5417967.0</topp:EMPLOYED><topp:UNEMPLOY>385040.0</topp:UNEMPLOY><topp:SERVICE>1360159.0</topp:SERVICE><topp:MANUAL>828906.0</topp:MANUAL><topp:P_MALE>0.486</topp:P_MALE><topp:P_FEMALE>0.514</topp:P_FEMALE><topp:SAMP_POP>1747776.0</topp:SAMP_POP></topp:states><topp:states fid="states.2"><topp:the_geom><gml:MultiPolygon srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:polygonMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>38.966 -77.008 38.889 -76.911 38.788 -77.045 38.813 -77.035 38.829 -77.045 38.838 -77.041 38.862 -77.039 38.886 -77.067 38.915 -77.078 38.932 -77.122 38.993 -77.042 38.966 -77.008</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom><topp:STATE_NAME>District of Columbia</topp:STATE_NAME><topp:STATE_FIPS>11</topp:STATE_FIPS><topp:SUB_REGION>S Atl</topp:SUB_REGION><topp:STATE_ABBR>DC</topp:STATE_ABBR><topp:LAND_KM>159.055</topp:LAND_KM><topp:WATER_KM>17.991</topp:WATER_KM><topp:PERSONS>606900.0</topp:PERSONS><topp:FAMILIES>122087.0</topp:FAMILIES><topp:HOUSHOLD>249634.0</topp:HOUSHOLD><topp:MALE>282970.0</topp:MALE><topp:FEMALE>323930.0</topp:FEMALE><topp:WORKERS>229975.0</topp:WORKERS><topp:DRVALONE>106694.0</topp:DRVALONE><topp:CARPOOL>36621.0</topp:CARPOOL><topp:PUBTRANS>111422.0</topp:PUBTRANS><topp:EMPLOYED>303994.0</topp:EMPLOYED><topp:UNEMPLOY>23442.0</topp:UNEMPLOY><topp:SERVICE>65498.0</topp:SERVICE><topp:MANUAL>22407.0</topp:MANUAL><topp:P_MALE>0.466</topp:P_MALE><topp:P_FEMALE>0.534</topp:P_FEMALE><topp:SAMP_POP>72696.0</topp:SAMP_POP></topp:states><topp:states fid="states.3"><topp:the_geom><gml:MultiPolygon srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:polygonMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>38.557 -75.707 38.649 -75.711 38.831 -75.724 39.141 -75.752 39.247 -75.761 39.295 -75.764 39.383 -75.772 39.723 -75.791 39.724 -75.775 39.774 -75.745 39.821 -75.695 39.838 -75.644 39.841 -75.583 39.826 -75.471 39.798 -75.421 39.789 -75.412 39.778 -75.428 39.763 -75.461 39.741 -75.475 39.719 -75.476 39.714 -75.489 39.612 -75.611 39.566 -75.562 39.463 -75.591 39.366 -75.515 39.257 -75.402 39.073 -75.397 39.012 -75.324 38.945 -75.307 38.808 -75.191 38.799 -75.083 38.449 -75.045 38.449 -75.068 38.451 -75.093 38.455 -75.351 38.463 -75.699 38.557 -75.707</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom><topp:STATE_NAME>Delaware</topp:STATE_NAME><topp:STATE_FIPS>10</topp:STATE_FIPS><topp:SUB_REGION>S Atl</topp:SUB_REGION><topp:STATE_ABBR>DE</topp:STATE_ABBR><topp:LAND_KM>5062.456</topp:LAND_KM><topp:WATER_KM>1385.022</topp:WATER_KM><topp:PERSONS>666168.0</topp:PERSONS><topp:FAMILIES>175867.0</topp:FAMILIES><topp:HOUSHOLD>247497.0</topp:HOUSHOLD><topp:MALE>322968.0</topp:MALE><topp:FEMALE>343200.0</topp:FEMALE><topp:WORKERS>247566.0</topp:WORKERS><topp:DRVALONE>258087.0</topp:DRVALONE><topp:CARPOOL>42968.0</topp:CARPOOL><topp:PUBTRANS>8069.0</topp:PUBTRANS><topp:EMPLOYED>335147.0</topp:EMPLOYED><topp:UNEMPLOY>13945.0</topp:UNEMPLOY><topp:SERVICE>87973.0</topp:SERVICE><topp:MANUAL>44140.0</topp:MANUAL><topp:P_MALE>0.485</topp:P_MALE><topp:P_FEMALE>0.515</topp:P_FEMALE><topp:SAMP_POP>102776.0</topp:SAMP_POP></topp:states></gml:featureMembers> 426 --></div> 427 <div id="v3/topp-states-wfs.xml"><!-- 428 <?xml version="1.0" encoding="UTF-8"?> 429 <wfs:FeatureCollection numberOfFeatures="3" timeStamp="2008-09-12T00:24:21.013-04:00" xsi:schemaLocation="http://www.openplans.org/topp http://sigma.openplans.org:80/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:states http://www.opengis.net/wfs http://sigma.openplans.org:80/geoserver/schemas/wfs/1.1.0/wfs.xsd" xmlns:ogc="http://www.opengis.net/ogc" xmlns:opengeo="http://open-geo.com" xmlns:tiger="http://www.census.gov" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:seb="http://seb.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"><gml:featureMembers><topp:states gml:id="states.1"><gml:boundedBy><gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:lowerCorner>36.986 -91.516</gml:lowerCorner><gml:upperCorner>42.509 -87.507</gml:upperCorner></gml:Envelope></gml:boundedBy><topp:the_geom><gml:MultiSurface srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>37.511 -88.071 37.476 -88.087 37.442 -88.311 37.409 -88.359 37.421 -88.419 37.401 -88.467 37.296 -88.511 37.257 -88.501 37.205 -88.451 37.156 -88.422 37.098 -88.451 37.072 -88.476 37.068 -88.491 37.064 -88.517 37.072 -88.559 37.109 -88.614 37.135 -88.688 37.141 -88.739 37.152 -88.746 37.202 -88.863 37.218 -88.932 37.221 -88.993 37.185 -89.065 37.112 -89.116 37.093 -89.146 37.064 -89.169 37.025 -89.174 36.998 -89.151 36.988 -89.129 36.986 -89.193 37.028 -89.211 37.041 -89.237 37.087 -89.264 37.091 -89.284 37.085 -89.303 37.061 -89.309 37.027 -89.264 37.008 -89.262 36.999 -89.282 37.009 -89.311 37.049 -89.382 37.099 -89.379 37.137 -89.423 37.165 -89.441 37.224 -89.468 37.253 -89.465 37.256 -89.489 37.276 -89.513 37.304 -89.513 37.329 -89.501 37.339 -89.468 37.355 -89.435 37.411 -89.427 37.453 -89.453 37.491 -89.494 37.571 -89.524 37.615 -89.513 37.651 -89.519 37.679 -89.513 37.694 -89.521 37.706 -89.581 37.745 -89.666 37.783 -89.675 37.804 -89.691 37.841 -89.728 37.905 -89.851 37.905 -89.861 37.891 -89.866 37.875 -89.901 37.878 -89.937 37.911 -89.978 37.963 -89.958 37.969 -90.011 37.993 -90.041 38.032 -90.119 38.053 -90.134 38.088 -90.207 38.122 -90.254 38.166 -90.289 38.188 -90.336 38.234 -90.364 38.323 -90.369 38.365 -90.358 38.391 -90.339 38.427 -90.301 38.518 -90.265 38.532 -90.261 38.562 -90.241 38.611 -90.183 38.658 -90.183 38.701 -90.202 38.723 -90.196 38.773 -90.163 38.785 -90.135 38.801 -90.121 38.831 -90.113 38.853 -90.132 38.914 -90.243 38.924 -90.278 38.924 -90.319 38.962 -90.413 38.959 -90.469 38.891 -90.531 38.871 -90.571 38.881 -90.627 38.935 -90.668 39.037 -90.706 39.058 -90.707 39.093 -90.691 39.144 -90.716 39.195 -90.718 39.224 -90.732 39.247 -90.738 39.296 -90.779 39.351 -90.851 39.401 -90.947 39.444 -91.036 39.473 -91.064 39.528 -91.093 39.552 -91.156 39.601 -91.203 39.685 -91.317 39.724 -91.367 39.761 -91.373 39.803 -91.381 39.863 -91.449 39.885 -91.451 39.901 -91.434 39.921 -91.431 39.946 -91.447 40.005 -91.487 40.066 -91.504 40.134 -91.516 40.201 -91.506 40.251 -91.498 40.309 -91.486 40.371 -91.448 40.386 -91.418 40.392 -91.385 40.402 -91.372 40.447 -91.385 40.503 -91.374 40.528 -91.382 40.547 -91.412 40.572 -91.411 40.603 -91.375 40.639 -91.262 40.643 -91.214 40.656 -91.162 40.682 -91.129 40.705 -91.119 40.761 -91.092 40.833 -91.088 40.879 -91.049 40.923 -90.983 40.951 -90.961 41.071 -90.954 41.104 -90.957 41.144 -90.991 41.165 -91.018 41.176 -91.056 41.231 -91.101 41.267 -91.102 41.334 -91.073 41.401 -91.055 41.423 -91.027 41.431 -91.001 41.421 -90.949 41.444 -90.844 41.449 -90.779 41.451 -90.708 41.462 -90.658 41.509 -90.601 41.525 -90.541 41.527 -90.454 41.543 -90.434 41.567 -90.423 41.586 -90.348 41.602 -90.339 41.649 -90.341 41.722 -90.326 41.756 -90.304 41.781 -90.255 41.806 -90.195 41.931 -90.154 41.983 -90.142 42.033 -90.151 42.061 -90.168 42.103 -90.166 42.121 -90.176 42.122 -90.191 42.159 -90.231 42.197 -90.323 42.211 -90.367 42.242 -90.407 42.263 -90.417 42.341 -90.427 42.361 -90.441 42.388 -90.491 42.421 -90.563 42.461 -90.605 42.475 -90.648 42.494 -90.651 42.509 -90.638 42.508 -90.419 42.504 -89.923 42.503 -89.834 42.497 -89.401 42.497 -89.359 42.491 -88.939 42.491 -88.764 42.489 -88.706 42.491 -88.297 42.489 -88.194 42.489 -87.797 42.314 -87.836 42.156 -87.761 42.059 -87.671 41.847 -87.612 41.723 -87.529 41.469 -87.532 41.301 -87.532 41.173 -87.531 41.009 -87.532 40.745 -87.532 40.494 -87.537 40.483 -87.535 40.166 -87.535 39.887 -87.535 39.609 -87.535 39.477 -87.538 39.351 -87.541 39.338 -87.597 39.307 -87.625 39.297 -87.611 39.281 -87.615 39.258 -87.606 39.248 -87.584 39.208 -87.588 39.198 -87.594 39.196 -87.607 39.168 -87.644 39.146 -87.671 39.131 -87.659 39.113 -87.662 39.103 -87.631 39.088 -87.631 39.084 -87.612 39.062 -87.585 38.995 -87.581 38.994 -87.591 38.977 -87.547 38.963 -87.533 38.931 -87.531 38.904 -87.539 38.869 -87.559 38.857 -87.551 38.795 -87.507 38.776 -87.519 38.769 -87.508 38.736 -87.508 38.685 -87.543 38.672 -87.588 38.642 -87.625 38.622 -87.628 38.599 -87.619 38.593 -87.641 38.573 -87.652 38.547 -87.672 38.515 -87.651 38.501 -87.653 38.504 -87.679 38.481 -87.692 38.466 -87.756 38.457 -87.758 38.445 -87.738 38.417 -87.748 38.378 -87.784 38.352 -87.834 38.286 -87.851 38.285 -87.863 38.316 -87.874 38.315 -87.883 38.301 -87.888 38.281 -87.914 38.302 -87.913 38.304 -87.925 38.241 -87.981 38.234 -87.986 38.201 -87.977 38.171 -87.932 38.157 -87.931 38.136 -87.951 38.131 -87.973 38.103 -88.018 38.092 -88.012 38.096 -87.964 38.073 -87.975 38.054 -88.034 38.045 -88.043 38.038 -88.041 38.033 -88.021 38.008 -88.029 37.975 -88.021 37.956 -88.042 37.934 -88.041 37.929 -88.064 37.944 -88.078 37.923 -88.084 37.917 -88.031 37.905 -88.026 37.896 -88.044 37.906 -88.101 37.895 -88.101 37.867 -88.075 37.843 -88.034 37.827 -88.042 37.831 -88.089 37.817 -88.086 37.805 -88.035 37.735 -88.072 37.701 -88.133 37.661 -88.159 37.628 -88.157 37.583 -88.134 37.511 -88.071</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></topp:the_geom><topp:STATE_NAME>Illinois</topp:STATE_NAME><topp:STATE_FIPS>17</topp:STATE_FIPS><topp:SUB_REGION>E N Cen</topp:SUB_REGION><topp:STATE_ABBR>IL</topp:STATE_ABBR><topp:LAND_KM>143986.61</topp:LAND_KM><topp:WATER_KM>1993.335</topp:WATER_KM><topp:PERSONS>1.143E7</topp:PERSONS><topp:FAMILIES>2924880.0</topp:FAMILIES><topp:HOUSHOLD>4202240.0</topp:HOUSHOLD><topp:MALE>5552233.0</topp:MALE><topp:FEMALE>5878369.0</topp:FEMALE><topp:WORKERS>4199206.0</topp:WORKERS><topp:DRVALONE>3741715.0</topp:DRVALONE><topp:CARPOOL>652603.0</topp:CARPOOL><topp:PUBTRANS>538071.0</topp:PUBTRANS><topp:EMPLOYED>5417967.0</topp:EMPLOYED><topp:UNEMPLOY>385040.0</topp:UNEMPLOY><topp:SERVICE>1360159.0</topp:SERVICE><topp:MANUAL>828906.0</topp:MANUAL><topp:P_MALE>0.486</topp:P_MALE><topp:P_FEMALE>0.514</topp:P_FEMALE><topp:SAMP_POP>1747776.0</topp:SAMP_POP></topp:states><topp:states gml:id="states.2"><gml:boundedBy><gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:lowerCorner>38.788 -77.122</gml:lowerCorner><gml:upperCorner>38.993 -76.911</gml:upperCorner></gml:Envelope></gml:boundedBy><topp:the_geom><gml:MultiSurface srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>38.966 -77.008 38.889 -76.911 38.788 -77.045 38.813 -77.035 38.829 -77.045 38.838 -77.041 38.862 -77.039 38.886 -77.067 38.915 -77.078 38.932 -77.122 38.993 -77.042 38.966 -77.008</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></topp:the_geom><topp:STATE_NAME>District of Columbia</topp:STATE_NAME><topp:STATE_FIPS>11</topp:STATE_FIPS><topp:SUB_REGION>S Atl</topp:SUB_REGION><topp:STATE_ABBR>DC</topp:STATE_ABBR><topp:LAND_KM>159.055</topp:LAND_KM><topp:WATER_KM>17.991</topp:WATER_KM><topp:PERSONS>606900.0</topp:PERSONS><topp:FAMILIES>122087.0</topp:FAMILIES><topp:HOUSHOLD>249634.0</topp:HOUSHOLD><topp:MALE>282970.0</topp:MALE><topp:FEMALE>323930.0</topp:FEMALE><topp:WORKERS>229975.0</topp:WORKERS><topp:DRVALONE>106694.0</topp:DRVALONE><topp:CARPOOL>36621.0</topp:CARPOOL><topp:PUBTRANS>111422.0</topp:PUBTRANS><topp:EMPLOYED>303994.0</topp:EMPLOYED><topp:UNEMPLOY>23442.0</topp:UNEMPLOY><topp:SERVICE>65498.0</topp:SERVICE><topp:MANUAL>22407.0</topp:MANUAL><topp:P_MALE>0.466</topp:P_MALE><topp:P_FEMALE>0.534</topp:P_FEMALE><topp:SAMP_POP>72696.0</topp:SAMP_POP></topp:states><topp:states gml:id="states.3"><gml:boundedBy><gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:lowerCorner>38.449 -75.791</gml:lowerCorner><gml:upperCorner>39.841 -75.045</gml:upperCorner></gml:Envelope></gml:boundedBy><topp:the_geom><gml:MultiSurface srsName="urn:x-ogc:def:crs:EPSG:4326"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>38.557 -75.707 38.649 -75.711 38.831 -75.724 39.141 -75.752 39.247 -75.761 39.295 -75.764 39.383 -75.772 39.723 -75.791 39.724 -75.775 39.774 -75.745 39.821 -75.695 39.838 -75.644 39.841 -75.583 39.826 -75.471 39.798 -75.421 39.789 -75.412 39.778 -75.428 39.763 -75.461 39.741 -75.475 39.719 -75.476 39.714 -75.489 39.612 -75.611 39.566 -75.562 39.463 -75.591 39.366 -75.515 39.257 -75.402 39.073 -75.397 39.012 -75.324 38.945 -75.307 38.808 -75.191 38.799 -75.083 38.449 -75.045 38.449 -75.068 38.451 -75.093 38.455 -75.351 38.463 -75.699 38.557 -75.707</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></topp:the_geom><topp:STATE_NAME>Delaware</topp:STATE_NAME><topp:STATE_FIPS>10</topp:STATE_FIPS><topp:SUB_REGION>S Atl</topp:SUB_REGION><topp:STATE_ABBR>DE</topp:STATE_ABBR><topp:LAND_KM>5062.456</topp:LAND_KM><topp:WATER_KM>1385.022</topp:WATER_KM><topp:PERSONS>666168.0</topp:PERSONS><topp:FAMILIES>175867.0</topp:FAMILIES><topp:HOUSHOLD>247497.0</topp:HOUSHOLD><topp:MALE>322968.0</topp:MALE><topp:FEMALE>343200.0</topp:FEMALE><topp:WORKERS>247566.0</topp:WORKERS><topp:DRVALONE>258087.0</topp:DRVALONE><topp:CARPOOL>42968.0</topp:CARPOOL><topp:PUBTRANS>8069.0</topp:PUBTRANS><topp:EMPLOYED>335147.0</topp:EMPLOYED><topp:UNEMPLOY>13945.0</topp:UNEMPLOY><topp:SERVICE>87973.0</topp:SERVICE><topp:MANUAL>44140.0</topp:MANUAL><topp:P_MALE>0.485</topp:P_MALE><topp:P_FEMALE>0.515</topp:P_FEMALE><topp:SAMP_POP>102776.0</topp:SAMP_POP></topp:states></gml:featureMembers></wfs:FeatureCollection> 430 --></div> 431 <div id="v2/point-coord.xml"><!-- 432 <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 433 <gml:coord> 434 <gml:X>1</gml:X> 435 <gml:Y>2</gml:Y> 436 </gml:coord> 437 </gml:Point> 438 --></div> 439 <div id="v2/point-coordinates.xml"><!-- 440 <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 441 <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates> 442 </gml:Point> 443 --></div> 444 <div id="v2/linestring-coord.xml"><!-- 445 <gml:LineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 446 <gml:coord> 447 <gml:X>1</gml:X> 448 <gml:Y>2</gml:Y> 449 </gml:coord> 450 <gml:coord> 451 <gml:X>3</gml:X> 452 <gml:Y>4</gml:Y> 453 </gml:coord> 454 </gml:LineString> 455 --></div> 456 <div id="v2/linestring-coordinates.xml"><!-- 457 <gml:LineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 458 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4</gml:coordinates> 459 </gml:LineString> 460 --></div> 461 <div id="v2/multipoint-coord.xml"><!-- 462 <gml:MultiPoint xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 463 <gml:pointMember> 464 <gml:Point> 465 <gml:coord> 466 <gml:X>1</gml:X> 467 <gml:Y>2</gml:Y> 468 </gml:coord> 469 </gml:Point> 470 </gml:pointMember> 471 <gml:pointMember> 472 <gml:Point> 473 <gml:coord> 474 <gml:X>2</gml:X> 475 <gml:Y>3</gml:Y> 476 </gml:coord> 477 </gml:Point> 478 </gml:pointMember> 479 <gml:pointMember> 480 <gml:Point> 481 <gml:coord> 482 <gml:X>3</gml:X> 483 <gml:Y>4</gml:Y> 484 </gml:coord> 485 </gml:Point> 486 </gml:pointMember> 487 </gml:MultiPoint> 488 --></div> 489 <div id="v2/multipoint-coordinates.xml"><!-- 490 <gml:MultiPoint xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 491 <gml:pointMember> 492 <gml:Point> 493 <gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates> 494 </gml:Point> 495 </gml:pointMember> 496 <gml:pointMember> 497 <gml:Point> 498 <gml:coordinates decimal="." cs="," ts=" ">2,3</gml:coordinates> 499 </gml:Point> 500 </gml:pointMember> 501 <gml:pointMember> 502 <gml:Point> 503 <gml:coordinates decimal="." cs="," ts=" ">3,4</gml:coordinates> 504 </gml:Point> 505 </gml:pointMember> 506 </gml:MultiPoint> 507 --></div> 508 <div id="v2/multilinestring-coord.xml"><!-- 509 <gml:MultiLineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 510 <gml:lineStringMember> 511 <gml:LineString> 512 <gml:coord> 513 <gml:X>1</gml:X> 514 <gml:Y>2</gml:Y> 515 </gml:coord> 516 <gml:coord> 517 <gml:X>2</gml:X> 518 <gml:Y>3</gml:Y> 519 </gml:coord> 520 </gml:LineString> 521 </gml:lineStringMember> 522 <gml:lineStringMember> 523 <gml:LineString> 524 <gml:coord> 525 <gml:X>3</gml:X> 526 <gml:Y>4</gml:Y> 527 </gml:coord> 528 <gml:coord> 529 <gml:X>4</gml:X> 530 <gml:Y>5</gml:Y> 531 </gml:coord> 532 </gml:LineString> 533 </gml:lineStringMember> 534 </gml:MultiLineString> 535 --></div> 536 <div id="v2/multilinestring-coordinates.xml"><!-- 537 <gml:MultiLineString xmlns:gml="http://www.opengis.net/gml" srsName="foo"> 538 <gml:lineStringMember> 539 <gml:LineString> 540 <gml:coordinates decimal="." cs="," ts=" ">1,2 2,3</gml:coordinates> 541 </gml:LineString> 542 </gml:lineStringMember> 543 <gml:lineStringMember> 544 <gml:LineString> 545 <gml:coordinates decimal="." cs="," ts=" ">3,4 4,5</gml:coordinates> 546 </gml:LineString> 547 </gml:lineStringMember> 548 </gml:MultiLineString> 549 --></div> 550 </body> 551 </html> -
tests/Format/XML.html
old new 291 291 t.ok(found === false, "returns false for bad attribute"); 292 292 } 293 293 294 function test_ getNamespacePrefix(t) {295 t.plan( 6);294 function test_namespaces(t) { 295 t.plan(2); 296 296 297 // test that getNamespacePrefix returns null with no ns defined 298 var format = new OpenLayers.Format.XML(); 299 var got = format.getNamespacePrefix("http://example.com/foo"); 300 t.eq(got, null, "returns null when no namespaces are defined"); 297 var format = new OpenLayers.Format.XML({ 298 namespaces: { 299 "def": "http://example.com/default", 300 "foo": "http://example.com/foo", 301 "bar": "http://example.com/bar" 302 }, 303 defaultPrefix: "def" 304 }); 301 305 302 format.defaultPrefix = "def"; 303 format.namespaces = { 304 "def": "http://example.com/default", 305 "foo": "http://example.com/foo", 306 "bar": "http://example.com/bar" 307 }; 306 // test that prototype has not been altered 307 t.eq(OpenLayers.Format.XML.prototype.namespaces, null, 308 "setting namespaces at construction does not modify prototype"); 308 309 309 var cases = [ 310 {uri: null, expect: "def"}, 311 {uri: "http://example.com/default", expect: "def"}, 312 {uri: "http://example.com/foo", expect: "foo"}, 313 {uri: "http://example.com/bar", expect: "bar"}, 314 {uri: "http://example.com/nothing", expect: null} 315 ]; 310 // test that namespaceAlias has been set 311 t.eq(format.namespaceAlias["http://example.com/foo"], "foo", 312 "namespaceAlias mapping has been set"); 316 313 317 var test; 318 for(var i=0; i<cases.length; ++i) { 319 test = cases[i]; 320 t.eq(format.getNamespacePrefix(test.uri), test.expect, 321 "uri: " + test.uri + " works"); 322 } 314 } 315 316 function test_setNamespace(t) { 317 t.plan(3); 318 319 var format = new OpenLayers.Format.XML(); 320 321 // test that namespaces is an object 322 t.ok(format.namespaces instanceof Object, "empty namespace object set"); 323 324 format.setNamespace("foo", "http://example.com/foo"); 325 t.eq(format.namespaces["foo"], "http://example.com/foo", "alias -> uri mapping set"); 326 t.eq(format.namespaceAlias["http://example.com/foo"], "foo", "uri -> alias mapping set"); 323 327 324 328 } 325 329 -
tests/list-tests.html
old new 43 43 <li>Format/GeoJSON.html</li> 44 44 <li>Format/GeoRSS.html</li> 45 45 <li>Format/GML.html</li> 46 <li>Format/GML/v2.html</li> 47 <li>Format/GML/v3.html</li> 46 48 <li>Format/GPX.html</li> 47 49 <li>Format/JSON.html</li> 48 50 <li>Format/KML.html</li> -
lib/OpenLayers/Format/GML/v2.js
old new 1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the 3 * full text of the license. */ 4 5 /** 6 * @requires OpenLayers/Format/GML/Base.js 7 */ 8 9 /** 10 * Class: OpenLayers.Format.GML.v2 11 * Parses GML version 2. 12 * 13 * Inherits from: 14 * - <OpenLayers.Format.GML.Base> 15 */ 16 OpenLayers.Format.GML.v2 = OpenLayers.Class(OpenLayers.Format.GML.Base, { 17 18 /** 19 * Property: schemaLocation 20 * {String} Schema location for a particular minor version. 21 */ 22 schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd", 23 24 /** 25 * Constructor: OpenLayers.Format.GML.v2 26 * Create a parser for GML v2. 27 * 28 * Parameters: 29 * options - {Object} An optional object whose properties will be set on 30 * this instance. 31 * 32 * Valid options properties: 33 * featureType - {String} Local (without prefix) feature typeName (required). 34 * featureNS - {String} Feature namespace (required). 35 * geometryName - {String} Geometry element name. 36 */ 37 initialize: function(options) { 38 OpenLayers.Format.GML.Base.prototype.initialize.apply(this, [options]); 39 }, 40 41 /** 42 * Property: readers 43 * Contains public functions, grouped by namespace prefix, that will 44 * be applied when a namespaced node is found matching the function 45 * name. The function will be applied in the scope of this parser 46 * with two arguments: the node being read and a context object passed 47 * from the parent. 48 */ 49 readers: { 50 "gml": OpenLayers.Util.applyDefaults({ 51 "outerBoundaryIs": function(node, container) { 52 var obj = {}; 53 this.readChildNodes(node, obj); 54 container.outer = obj.components[0]; 55 }, 56 "innerBoundaryIs": function(node, container) { 57 var obj = {}; 58 this.readChildNodes(node, obj); 59 container.inner.push(obj.components[0]); 60 }, 61 "Box": function(node, container) { 62 var obj = {}; 63 this.readChildNodes(node, obj); 64 if(!container.components) { 65 container.components = []; 66 } 67 var min = obj.points[0]; 68 var max = obj.points[1]; 69 container.components.push( 70 new OpenLayers.Bounds(min.x, min.y, max.x, max.y) 71 ); 72 } 73 }, OpenLayers.Format.GML.Base.prototype.readers["gml"]), 74 "feature": OpenLayers.Format.GML.Base.prototype.readers["feature"], 75 "wfs": OpenLayers.Format.GML.Base.prototype.readers["wfs"] 76 }, 77 78 /** 79 * Method: write 80 * 81 * Parameters: 82 * features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector} 83 * An array of features or a single feature. 84 * 85 * Returns: 86 * {String} Given an array of features, a doc with a gml:featureMembers 87 * element will be returned. Given a single feature, a doc with a 88 * gml:featureMember element will be returned. 89 */ 90 write: function(features) { 91 var name; 92 if(features instanceof Array) { 93 // GML2 only has abstract feature collections 94 // wfs provides a feature collection from a well-known schema 95 name = "wfs:FeatureCollection"; 96 } else { 97 name = "gml:featureMember"; 98 } 99 var root = this.writeNode(name, features); 100 this.setAttributeNS( 101 root, this.namespaces["xsi"], 102 "xsi:schemaLocation", this.schemaLocation 103 ); 104 105 return OpenLayers.Format.XML.prototype.write.apply(this, [root]); 106 }, 107 108 /** 109 * Property: writers 110 * As a compliment to the readers property, this structure contains public 111 * writing functions grouped by namespace alias and named like the 112 * node names they produce. 113 */ 114 writers: { 115 "gml": OpenLayers.Util.applyDefaults({ 116 "Point": function(geometry) { 117 var node = this.createElementNSPlus("gml:Point"); 118 this.writeNode("coordinates", [geometry], node); 119 return node; 120 }, 121 "coordinates": function(points) { 122 var numPoints = points.length; 123 var parts = new Array(numPoints); 124 var point; 125 for(var i=0; i<numPoints; ++i) { 126 point = points[i]; 127 if(this.xy) { 128 parts[i] = point.x + "," + point.y; 129 } else { 130 parts[i] = point.y + "," + point.x; 131 } 132 if(point.z != undefined) { // allow null or undefined 133 parts[i] += "," + point.z; 134 } 135 } 136 return this.createElementNSPlus("gml:coordinates", { 137 attributes: { 138 decimal: ".", cs: ",", ts: " " 139 }, 140 value: (numPoints == 1) ? parts[0] : parts.join(" ") 141 }); 142 }, 143 "LineString": function(geometry) { 144 var node = this.createElementNSPlus("gml:LineString"); 145 this.writeNode("coordinates", geometry.components, node); 146 return node; 147 }, 148 "Polygon": function(geometry) { 149 var node = this.createElementNSPlus("gml:Polygon"); 150 this.writeNode("outerBoundaryIs", geometry.components[0], node); 151 for(var i=1; i<geometry.components.length; ++i) { 152 this.writeNode( 153 "innerBoundaryIs", geometry.components[i], node 154 ); 155 } 156 return node; 157 }, 158 "outerBoundaryIs": function(ring) { 159 var node = this.createElementNSPlus("gml:outerBoundaryIs"); 160 this.writeNode("LinearRing", ring, node); 161 return node; 162 }, 163 "innerBoundaryIs": function(ring) { 164 var node = this.createElementNSPlus("gml:innerBoundaryIs"); 165 this.writeNode("LinearRing", ring, node); 166 return node; 167 }, 168 "LinearRing": function(ring) { 169 var node = this.createElementNSPlus("gml:LinearRing"); 170 this.writeNode("coordinates", ring.components, node); 171 return node; 172 }, 173 "Box": function(bounds) { 174 var node = this.createElementNSPlus("gml:Box"); 175 this.writeNode("coordinates", [ 176 {x: bounds.left, y: bounds.bottom}, 177 {x: bounds.right, y: bounds.top} 178 ], node); 179 // srsName attribute is optional for gml:Box 180 if(this.srsName) { 181 node.setAttribute("srsName", this.srsName); 182 } 183 return node; 184 } 185 }, OpenLayers.Format.GML.Base.prototype.writers["gml"]), 186 "feature": OpenLayers.Format.GML.Base.prototype.writers["feature"], 187 "wfs": OpenLayers.Format.GML.Base.prototype.writers["wfs"] 188 }, 189 190 CLASS_NAME: "OpenLayers.Format.GML.v2" 191 192 }); -
lib/OpenLayers/Format/GML/v3.js
old new 1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the 3 * full text of the license. */ 4 5 /** 6 * @requires OpenLayers/Format/GML/Base.js 7 */ 8 9 /** 10 * Class: OpenLayers.Format.GML.v3 11 * Parses GML version 3. 12 * 13 * Inherits from: 14 * - <OpenLayers.Format.GML.Base> 15 */ 16 OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, { 17 18 /** 19 * Property: schemaLocation 20 * {String} Schema location for a particular minor version. The writers 21 * conform with the Simple Features Profile for GML. 22 */ 23 schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd", 24 25 /** 26 * Constructor: OpenLayers.Format.GML.v3 27 * Create a parser for GML v3. 28 * 29 * Parameters: 30 * options - {Object} An optional object whose properties will be set on 31 * this instance. 32 * 33 * Valid options properties: 34 * featureType - {String} Local (without prefix) feature typeName (required). 35 * featureNS - {String} Feature namespace (required). 36 * geometryName - {String} Geometry element name. 37 */ 38 initialize: function(options) { 39 OpenLayers.Format.GML.Base.prototype.initialize.apply(this, [options]); 40 }, 41 42 /** 43 * Property: readers 44 * Contains public functions, grouped by namespace prefix, that will 45 * be applied when a namespaced node is found matching the function 46 * name. The function will be applied in the scope of this parser 47 * with two arguments: the node being read and a context object passed 48 * from the parent. 49 */ 50 readers: { 51 "gml": OpenLayers.Util.applyDefaults({ 52 "featureMembers": function(node, obj) { 53 this.readChildNodes(node, obj); 54 }, 55 "pos": function(node, obj) { 56 var str = this.getChildValue(node).replace( 57 this.regExes.trimSpace, "" 58 ); 59 var coords = str.split(this.regExes.splitSpace); 60 var point; 61 if(this.xy) { 62 point = new OpenLayers.Geometry.Point( 63 coords[0], coords[1], coords[2] 64 ); 65 } else { 66 point = new OpenLayers.Geometry.Point( 67 coords[1], coords[0], coords[2] 68 ); 69 } 70 obj.points = [point]; 71 }, 72 "posList": function(node, obj) { 73 var str = this.concatChildValues(node).replace( 74 this.regExes.trimSpace, "" 75 ); 76 var coords = str.split(this.regExes.splitSpace); 77 var dim = parseInt(node.getAttribute("dimension")) || 2; 78 var j, x, y, z; 79 var numPoints = coords.length / dim; 80 var points = new Array(numPoints); 81 for(var i=0, len=coords.length; i<len; i += dim) { 82 x = coords[i]; 83 y = coords[i+1]; 84 z = (dim == 2) ? undefined : coords[i+2]; 85 if (this.xy) { 86 points[i/dim] = new OpenLayers.Geometry.Point(x, y, z); 87 } else { 88 points[i/dim] = new OpenLayers.Geometry.Point(y, x, z); 89 } 90 } 91 obj.points = points; 92 }, 93 "exterior": function(node, container) { 94 var obj = {}; 95 this.readChildNodes(node, obj); 96 container.outer = obj.components[0]; 97 }, 98 "interior": function(node, container) { 99 var obj = {}; 100 this.readChildNodes(node, obj); 101 container.inner.push(obj.components[0]); 102 }, 103 "MultiSurface": function(node, container) { 104 var obj = {components: []}; 105 this.readChildNodes(node, obj); 106 if(obj.components.length > 0) { 107 container.components = [ 108 new OpenLayers.Geometry.MultiPolygon(obj.components) 109 ]; 110 } 111 }, 112 "surfaceMember": function(node, obj) { 113 this.readChildNodes(node, obj); 114 }, 115 "surfaceMembers": function(node, obj) { 116 this.readChildNodes(node, obj); 117 }, 118 "pointMembers": function(node, obj) { 119 this.readChildNodes(node, obj); 120 }, 121 "lineStringMembers": function(node, obj) { 122 this.readChildNodes(node, obj); 123 }, 124 "polygonMembers": function(node, obj) { 125 this.readChildNodes(node, obj); 126 }, 127 "geometryMembers": function(node, obj) { 128 this.readChildNodes(node, obj); 129 }, 130 "Envelope": function(node, container) { 131 var obj = {points: new Array(2)}; 132 this.readChildNodes(node, obj); 133 if(!container.components) { 134 container.components = []; 135 } 136 var min = obj.points[0]; 137 var max = obj.points[1]; 138 container.components.push( 139 new OpenLayers.Bounds(min.x, min.y, max.x, max.y) 140 ); 141 }, 142 "lowerCorner": function(node, container) { 143 var obj = {}; 144 this.readChildNodes(node, obj) 145 container.points[0] = obj.points[0]; 146 }, 147 "upperCorner": function(node, container) { 148 var obj = {}; 149 this.readChildNodes(node, obj) 150 container.points[1] = obj.points[0]; 151 } 152 }, OpenLayers.Format.GML.Base.prototype.readers["gml"]), 153 "feature": OpenLayers.Format.GML.Base.prototype.readers["feature"], 154 "wfs": OpenLayers.Format.GML.Base.prototype.readers["wfs"] 155 }, 156 157 /** 158 * Method: write 159 * 160 * Parameters: 161 * features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector} 162 * An array of features or a single feature. 163 * 164 * Returns: 165 * {String} Given an array of features, a doc with a gml:featureMembers 166 * element will be returned. Given a single feature, a doc with a 167 * gml:featureMember element will be returned. 168 */ 169 write: function(features) { 170 var name; 171 if(features instanceof Array) { 172 name = "featureMembers"; 173 } else { 174 name = "featureMember"; 175 } 176 var root = this.writeNode("gml:" + name, features); 177 this.setAttributeNS( 178 root, this.namespaces["xsi"], 179 "xsi:schemaLocation", this.schemaLocation 180 ); 181 182 return OpenLayers.Format.XML.prototype.write.apply(this, [root]); 183 }, 184 185 /** 186 * Property: writers 187 * As a compliment to the readers property, this structure contains public 188 * writing functions grouped by namespace alias and named like the 189 * node names they produce. 190 */ 191 writers: { 192 "gml": OpenLayers.Util.applyDefaults({ 193 "featureMembers": function(features) { 194 var node = this.createElementNSPlus("gml:featureMembers"); 195 for(var i=0, len=features.length; i<len; ++i) { 196 this.writeNode("feature:_typeName", features[i], node); 197 } 198 return node; 199 }, 200 "Point": function(geometry) { 201 var node = this.createElementNSPlus("gml:Point"); 202 this.writeNode("pos", geometry, node); 203 return node; 204 }, 205 "pos": function(point) { 206 // only 2d for simple features profile 207 var pos = (this.xy) ? 208 (point.x + " " + point.y) : (point.y + " " + point.x); 209 return this.createElementNSPlus("gml:pos", { 210 value: pos 211 }); 212 }, 213 "LineString": function(geometry) { 214 var node = this.createElementNSPlus("gml:LineString"); 215 this.writeNode("posList", geometry.components, node); 216 return node; 217 }, 218 "posList": function(points) { 219 // only 2d for simple features profile 220 var len = points.length; 221 var parts = new Array(len); 222 var point; 223 for(var i=0; i<len; ++i) { 224 point = points[i]; 225 if(this.xy) { 226 parts[i] = point.x + " " + point.y; 227 } else { 228 parts[i] = point.y + " " + point.x; 229 } 230 } 231 return this.createElementNSPlus("gml:posList", { 232 value: parts.join(" ") 233 }); 234 }, 235 "Polygon": function(geometry) { 236 var node = this.createElementNSPlus("gml:Polygon"); 237 this.writeNode("exterior", geometry.components[0], node); 238 for(var i=1, len=geometry.components.length; i<len; ++i) { 239 this.writeNode( 240 "interior", geometry.components[i], node 241 ); 242 } 243 return node; 244 }, 245 "exterior": function(ring) { 246 var node = this.createElementNSPlus("gml:exterior"); 247 this.writeNode("LinearRing", ring, node); 248 return node; 249 }, 250 "interior": function(ring) { 251 var node = this.createElementNSPlus("gml:interior"); 252 this.writeNode("LinearRing", ring, node); 253 return node; 254 }, 255 "LinearRing": function(ring) { 256 var node = this.createElementNSPlus("gml:LinearRing"); 257 this.writeNode("posList", ring.components, node); 258 return node; 259 }, 260 "Envelope": function(bounds) { 261 var node = this.createElementNSPlus("gml:Envelope"); 262 this.writeNode("lowerCorner", bounds, node); 263 this.writeNode("upperCorner", bounds, node); 264 // srsName attribute is required for gml:Envelope 265 if(this.srsName) { 266 node.setAttribute("srsName", this.srsName); 267 } 268 return node; 269 }, 270 "lowerCorner": function(bounds) { 271 var node = this.createElementNSPlus("gml:lowerCorner"); 272 this.writeNode("pos", {x: bounds.left, y: bounds.bottom}, node); 273 return node; 274 }, 275 "upperCorner": function(bounds) { 276 var node = this.createElementNSPlus("gml:upperCorner"); 277 this.writeNode("pos", {x: bounds.right, y: bounds.top}, node); 278 return node; 279 } 280 }, OpenLayers.Format.GML.Base.prototype.writers["gml"]), 281 "feature": OpenLayers.Format.GML.Base.prototype.writers["feature"], 282 "wfs": OpenLayers.Format.GML.Base.prototype.writers["wfs"] 283 }, 284 285 CLASS_NAME: "OpenLayers.Format.GML.v3" 286 287 }); -
lib/OpenLayers/Format/GML/Base.js
old new 1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the 3 * full text of the license. */ 4 5 /** 6 * @requires OpenLayers/Format/XMl.js 7 */ 8 9 /** 10 * Eventually, this will require the OpenLayers.Format.GML. For now, since 11 * this parser can be included in a lib without the old GML parser, we 12 * declare the namespace if it doesn't exist. 13 */ 14 if(!OpenLayers.Format.GML) { 15 OpenLayers.Format.GML = {}; 16 } 17 18 /** 19 * Class: OpenLayers.Format.GML.Base 20 * Superclass for GML parsers. 21 * 22 * Inherits from: 23 * - <OpenLayers.Format.XML> 24 */ 25 OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, { 26 27 /** 28 * Property: namespaces 29 * {Object} Mapping of namespace aliases to namespace URIs. 30 */ 31 namespaces: { 32 gml: "http://www.opengis.net/gml", 33 xlink: "http://www.w3.org/1999/xlink", 34 xsi: "http://www.w3.org/2001/XMLSchema-instance", 35 wfs: "http://www.opengis.net/wfs" // this is a convenience for reading wfs:FeatureCollection 36 }, 37 38 /** 39 * Property: defaultPrefix 40 */ 41 defaultPrefix: "gml", 42 43 /** 44 * Property: schemaLocation 45 * {String} Schema location for a particular minor version. 46 */ 47 schemaLocation: null, 48 49 /** 50 * APIProperty: featureType 51 * {String} The local (without prefix) feature typeName. 52 */ 53 featureType: null, 54 55 /** 56 * APIProperty: featureNS 57 * {String} The feature namespace. Must be set in the options at 58 * construction. 59 */ 60 featureNS: null, 61 62 /** 63 * APIProperty: geometry 64 * {String} Name of geometry element. Defaults to "geometry". 65 */ 66 geometryName: "geometry", 67 68 /** 69 * APIProperty: extractAttributes 70 * {Boolean} Extract attributes from GML. Default is true. 71 */ 72 extractAttributes: true, 73 74 /** 75 * APIProperty: srsName 76 * {String} URI for spatial reference system. This is optional for 77 * single part geometries and mandatory for collections and multis. 78 * If set, the srsName attribute will be written for all geometries. 79 * Default is null. 80 */ 81 srsName: null, 82 83 /** 84 * APIProperty: xy 85 * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) 86 * Changing is not recommended, a new Format should be instantiated. 87 */ 88 xy: true, 89 90 /** 91 * Property: regExes 92 * Compiled regular expressions for manipulating strings. 93 */ 94 regExes: { 95 trimSpace: (/^\s*|\s*$/g), 96 removeSpace: (/\s*/g), 97 splitSpace: (/\s+/), 98 trimComma: (/\s*,\s*/g) 99 }, 100 101 /** 102 * Constructor: OpenLayers.Format.GML.Base 103 * Instances of this class are not created directly. Use the 104 * <OpenLayers.Format.GML.v2> or <OpenLayers.Format.GML.v3> constructor 105 * instead. 106 * 107 * Parameters: 108 * options - {Object} An optional object whose properties will be set on 109 * this instance. 110 * 111 * Valid options properties: 112 * featureType - {String} Local (without prefix) feature typeName (required). 113 * featureNS - {String} Feature namespace (required). 114 * geometryName - {String} Geometry element name. 115 */ 116 initialize: function(options) { 117 OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); 118 this.setNamespace("feature", options.featureNS); 119 }, 120 121 /** 122 * Method: read 123 * 124 * Parameters: 125 * data - {DOMElement} A gml:featureMember element, a gml:featureMembers 126 * element, or an element containing either of the above at any level. 127 * 128 * Returns: 129 * {Array(<OpenLayers.Feature.Vector>)} An array of features. 130 */ 131 read: function(data) { 132 if(typeof data == "string") { 133 data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); 134 } 135 if(data && data.nodeType == 9) { 136 data = data.documentElement; 137 } 138 var features = []; 139 this.readNode(data, {features: features}); 140 if(features.length == 0) { 141 // look for gml:featureMember elements 142 var elements = this.getElementsByTagNameNS( 143 data, this.namespaces.gml, "featureMember" 144 ); 145 if(elements.length) { 146 for(var i=0, len=elements.length; i<len; ++i) { 147 this.readNode(elements[i], {features: features}); 148 } 149 } else { 150 // look for gml:featureMembers elements (this is v3, but does no harm here) 151 var elements = this.getElementsByTagNameNS( 152 data, this.namespaces.gml, "featureMembers" 153 ); 154 if(elements.length) { 155 // there can be only one 156 this.readNode(elements[0], {features: features}); 157 } 158 } 159 } 160 return features; 161 }, 162 163 /** 164 * Property: readers 165 * Contains public functions, grouped by namespace prefix, that will 166 * be applied when a namespaced node is found matching the function 167 * name. The function will be applied in the scope of this parser 168 * with two arguments: the node being read and a context object passed 169 * from the parent. 170 */ 171 readers: { 172 "gml": { 173 "featureMember": function(node, obj) { 174 this.readChildNodes(node, obj); 175 }, 176 "featureMembers": function(node, obj) { 177 this.readChildNodes(node, obj); 178 }, 179 "Point": function(node, container) { 180 var obj = {points: []}; 181 this.readChildNodes(node, obj); 182 if(!container.components) { 183 container.components = []; 184 } 185 container.components.push(obj.points[0]); 186 }, 187 "coordinates": function(node, obj) { 188 var str = this.concatChildValues(node).replace( 189 this.regExes.trimSpace, "" 190 ); 191 str = str.replace(this.regExes.trimComma, ","); 192 var pointList = str.split(this.regExes.splitSpace); 193 var coords; 194 var numPoints = pointList.length; 195 var points = new Array(numPoints); 196 for(var i=0; i<numPoints; ++i) { 197 coords = pointList[i].split(","); 198 if (this.xy) { 199 points[i] = new OpenLayers.Geometry.Point( 200 coords[0], coords[1], coords[2] 201 ); 202 } else { 203 points[i] = new OpenLayers.Geometry.Point( 204 coords[1], coords[0], coords[2] 205 ); 206 } 207 } 208 obj.points = points; 209 }, 210 "coord": function(node, obj) { 211 var coord = {}; 212 this.readChildNodes(node, coord); 213 if(!obj.points) { 214 obj.points = []; 215 } 216 obj.points.push(new OpenLayers.Geometry.Point( 217 coord.x, coord.y, coord.z 218 )); 219 }, 220 "X": function(node, coord) { 221 coord.x = this.getChildValue(node); 222 }, 223 "Y": function(node, coord) { 224 coord.y = this.getChildValue(node); 225 }, 226 "Z": function(node, coord) { 227 coord.z = this.getChildValue(node); 228 }, 229 "MultiPoint": function(node, container) { 230 var obj = {components: []}; 231 this.readChildNodes(node, obj); 232 container.components = [ 233 new OpenLayers.Geometry.MultiPoint(obj.components) 234 ]; 235 }, 236 "pointMember": function(node, obj) { 237 this.readChildNodes(node, obj); 238 }, 239 "LineString": function(node, container) { 240 var obj = {}; 241 this.readChildNodes(node, obj); 242 if(!container.components) { 243 container.components = []; 244 } 245 container.components.push( 246 new OpenLayers.Geometry.LineString(obj.points) 247 ); 248 }, 249 "MultiLineString": function(node, container) { 250 var obj = {components: []}; 251 this.readChildNodes(node, obj); 252 container.components = [ 253 new OpenLayers.Geometry.MultiLineString(obj.components) 254 ]; 255 }, 256 "lineStringMember": function(node, obj) { 257 this.readChildNodes(node, obj); 258 }, 259 "Polygon": function(node, container) { 260 var obj = {outer: null, inner: []}; 261 this.readChildNodes(node, obj); 262 obj.inner.unshift(obj.outer); 263 if(!container.components) { 264 container.components = []; 265 } 266 container.components.push( 267 new OpenLayers.Geometry.Polygon(obj.inner) 268 ); 269 }, 270 "LinearRing": function(node, obj) { 271 var container = {}; 272 this.readChildNodes(node, container); 273 obj.components = [new OpenLayers.Geometry.LinearRing( 274 container.points 275 )]; 276 }, 277 "MultiPolygon": function(node, container) { 278 var obj = {components: []}; 279 this.readChildNodes(node, obj); 280 container.components = [ 281 new OpenLayers.Geometry.MultiPolygon(obj.components) 282 ]; 283 }, 284 "polygonMember": function(node, obj) { 285 this.readChildNodes(node, obj); 286 }, 287 "GeometryCollection": function(node, container) { 288 var obj = {components: []}; 289 this.readChildNodes(node, obj); 290 container.components = [ 291 new OpenLayers.Geometry.Collection(obj.components) 292 ]; 293 }, 294 "geometryMember": function(node, obj) { 295 this.readChildNodes(node, obj); 296 } 297 }, 298 "feature": { 299 "*": function(node, obj) { 300 // The node can either be named like the featureType, or it 301 // can be a child of the feature:featureType. Children can be 302 // geometry or attributes. 303 var name; 304 var local = node.localName || node.nodeName.split(":").pop(); 305 if(local == this.featureType) { 306 name = "_typeName"; 307 } else { 308 // Assume attribute elements have one child node and that the child 309 // is a text node. Otherwise assume it is a geometry node. 310 if(node.childNodes.length == 1 && node.firstChild.nodeType == 3) { 311 if(this.extractAttributes) { 312 name = "_attribute"; 313 } 314 } else { 315 name = "_geometry"; 316 } 317 } 318 if(name) { 319 this.readers.feature[name].apply(this, [node, obj]); 320 } 321 }, 322 "_typeName": function(node, obj) { 323 var container = {components: [], attributes: {}}; 324 this.readChildNodes(node, container); 325 var feature = new OpenLayers.Feature.Vector( 326 container.components[0], container.attributes 327 ); 328 var fid = node.getAttribute("fid") || 329 this.getAttributeNS(node, this.namespaces["gml"], "id"); 330 if(fid) { 331 feature.fid = fid; 332 } 333 if(this.internalProjection && this.externalProjection && 334 feature.geometry) { 335 feature.geometry.transform( 336 this.externalProjection, this.internalProjection 337 ); 338 } 339 obj.features.push(feature); 340 }, 341 "_geometry": function(node, obj) { 342 this.readChildNodes(node, obj); 343 }, 344 "_attribute": function(node, obj) { 345 var local = node.localName || node.nodeName.split(":").pop(); 346 var value = this.getChildValue(node); 347 obj.attributes[local] = value; 348 } 349 }, 350 "wfs": { 351 "FeatureCollection": function(node, obj) { 352 this.readChildNodes(node, obj); 353 } 354 } 355 }, 356 357 /** 358 * Method: write 359 * 360 * Parameters: 361 * features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector} 362 * An array of features or a single feature. 363 * 364 * Returns: 365 * {String} Given an array of features, a doc with a gml:featureMembers 366 * element will be returned. Given a single feature, a doc with a 367 * gml:featureMember element will be returned. 368 */ 369 write: function(features) { 370 var name; 371 if(features instanceof Array) { 372 name = "featureMembers"; 373 } else { 374 name = "featureMember"; 375 } 376 var root = this.writeNode("gml:" + name, features); 377 this.setAttributeNS( 378 root, this.namespaces["xsi"], 379 "xsi:schemaLocation", this.schemaLocation 380 ); 381 382 return OpenLayers.Format.XML.prototype.write.apply(this, [root]); 383 }, 384 385 /** 386 * Property: writers 387 * As a compliment to the readers property, this structure contains public 388 * writing functions grouped by namespace alias and named like the 389 * node names they produce. 390 */ 391 writers: { 392 "gml": { 393 "featureMember": function(feature) { 394 var node = this.createElementNSPlus("gml:featureMember"); 395 this.writeNode("feature:_typeName", feature, node); 396 return node; 397 }, 398 "MultiPoint": function(geometry) { 399 var node = this.createElementNSPlus("gml:MultiPoint"); 400 for(var i=0; i<geometry.components.length; ++i) { 401 this.writeNode("pointMember", geometry.components[i], node); 402 } 403 return node; 404 }, 405 "pointMember": function(geometry) { 406 var node = this.createElementNSPlus("gml:pointMember"); 407 this.writeNode("Point", geometry, node); 408 return node; 409 }, 410 "MultiLineString": function(geometry) { 411 var node = this.createElementNSPlus("gml:MultiLineString"); 412 for(var i=0; i<geometry.components.length; ++i) { 413 this.writeNode("lineStringMember", geometry.components[i], node); 414 } 415 return node; 416 }, 417 "lineStringMember": function(geometry) { 418 var node = this.createElementNSPlus("gml:lineStringMember"); 419 this.writeNode("LineString", geometry, node); 420 return node; 421 }, 422 "MultiPolygon": function(geometry) { 423 var node = this.createElementNSPlus("gml:MultiPolygon"); 424 for(var i=0; i<geometry.components.length; ++i) { 425 this.writeNode( 426 "polygonMember", geometry.components[i], node 427 ); 428 } 429 return node; 430 }, 431 "polygonMember": function(geometry) { 432 var node = this.createElementNSPlus("gml:polygonMember"); 433 this.writeNode("Polygon", geometry, node); 434 return node; 435 }, 436 "GeometryCollection": function(geometry) { 437 var node = this.createElementNSPlus("gml:GeometryCollection"); 438 for(var i=0, len=geometry.components.length; i<len; ++i) { 439 this.writeNode("geometryMember", geometry.components[i], node); 440 } 441 return node; 442 }, 443 "geometryMember": function(geometry) { 444 var node = this.createElementNSPlus("gml:geometryMember"); 445 var child = this.writeNode("feature:_geometry", geometry); 446 node.appendChild(child.firstChild); 447 return node; 448 } 449 }, 450 "feature": { 451 "_typeName": function(feature) { 452 var node = this.createElementNSPlus("feature:" + this.featureType, { 453 attributes: {fid: feature.fid} 454 }); 455 if(feature.geometry) { 456 this.writeNode("feature:_geometry", feature.geometry, node); 457 } 458 for(var name in feature.attributes) { 459 var value = feature.attributes[name]; 460 if(value != null) { 461 this.writeNode( 462 "feature:_attribute", 463 {name: name, value: value}, node 464 ) 465 } 466 } 467 return node; 468 }, 469 "_geometry": function(geometry) { 470 if(this.externalProjection && this.internalProjection) { 471 geometry = geometry.clone().transform( 472 this.internalProjection, this.externalProjection 473 ); 474 } 475 var node = this.createElementNSPlus( 476 "feature:" + this.geometryName 477 ); 478 var type = this.geometryTypes[geometry.CLASS_NAME]; 479 var child = this.writeNode("gml:" + type, geometry, node); 480 if(this.srsName) { 481 child.setAttribute("srsName", this.srsName); 482 } 483 return node; 484 }, 485 "_attribute": function(obj) { 486 return this.createElementNSPlus("feature:" + obj.name, { 487 value: obj.value 488 }); 489 } 490 }, 491 "wfs": { 492 "FeatureCollection": function(features) { 493 /** 494 * This is only here because GML2 only describes abstract 495 * feature collections. Typically, you would not be using 496 * the GML format to write wfs elements. This just provides 497 * some way to write out lists of features. GML3 defines the 498 * featureMembers element, so that is used by default instead. 499 */ 500 var node = this.createElementNSPlus("wfs:FeatureCollection"); 501 for(var i=0, len=features.length; i<len; ++i) { 502 this.writeNode("gml:featureMember", features[i], node); 503 } 504 return node; 505 } 506 } 507 }, 508 509 /** 510 * Property: geometryTypes 511 * {Object} Maps OpenLayers geometry class names to GML element names. 512 */ 513 geometryTypes: { 514 "OpenLayers.Geometry.Point": "Point", 515 "OpenLayers.Geometry.MultiPoint": "MultiPoint", 516 "OpenLayers.Geometry.LineString": "LineString", 517 "OpenLayers.Geometry.MultiLineString": "MultiLineString", 518 "OpenLayers.Geometry.Polygon": "Polygon", 519 "OpenLayers.Geometry.MultiPolygon": "MultiPolygon", 520 "OpenLayers.Geometry.Collection": "GeometryCollection" 521 }, 522 523 CLASS_NAME: "OpenLayers.Format.GML.Base" 524 525 }); -
lib/OpenLayers/Format/XML.js
old new 22 22 /** 23 23 * Property: namespaces 24 24 * {Object} Mapping of namespace aliases to namespace URIs. Properties 25 * of this object should not be set individually. 25 * of this object should not be set individually. Read-only. All 26 * XML subclasses should have their own namespaces object. Use 27 * <setNamespace> to add or set a namespace alias after construction. 26 28 */ 27 namespaces: {},29 namespaces: null, 28 30 29 31 /** 30 * Property: defaultNamespace 32 * Property: namespaceAlias 33 * {Object} Mapping of namespace URI to namespace alias. This object 34 * is read-only. Use <setNamespace> to add or set a namespace alias. 35 */ 36 namespaceAlias: null, 37 38 /** 39 * Property: defaultPrefix 31 40 * {String} The default namespace alias for creating element nodes. 32 41 */ 33 default Namespace: null,42 defaultPrefix: null, 34 43 35 44 /** 36 45 * Property: readers … … 75 84 this.xmldom = new ActiveXObject("Microsoft.XMLDOM"); 76 85 } 77 86 OpenLayers.Format.prototype.initialize.apply(this, [options]); 87 // clone the namespace object and set all namespace aliases 88 this.namespaces = OpenLayers.Util.extend({}, this.namespaces); 89 this.namespaceAlias = {}; 90 for(var alias in this.namespaces) { 91 this.namespaceAlias[this.namespaces[alias]] = alias; 92 } 78 93 }, 79 94 80 95 /** … … 85 100 this.xmldom = null; 86 101 OpenLayers.Format.prototype.destroy.apply(this, arguments); 87 102 }, 103 104 /** 105 * Method: setNamespace 106 * Set a namespace alias and URI for the format. 107 * 108 * Parameters: 109 * alias - {String} The namespace alias (prefix). 110 * uri - {String} The namespace URI. 111 */ 112 setNamespace: function(alias, uri) { 113 this.namespaces[alias] = uri; 114 this.namespaceAlias[uri] = alias; 115 }, 88 116 89 117 /** 90 118 * APIMethod: read … … 329 357 * {String} The value of the first child of the given node. 330 358 */ 331 359 getChildValue: function(node, def) { 332 var value; 333 if (node && node.firstChild && node.firstChild.nodeValue) { 334 value = node.firstChild.nodeValue; 335 } else { 336 value = (def != undefined) ? def : ""; 360 var value = def || ""; 361 if(node) { 362 var child = node.firstChild; 363 if(child) { 364 value = child.nodeValue || value; 365 } 337 366 } 338 367 return value; 339 368 }, … … 425 454 }, 426 455 427 456 /** 428 * Method: getNamespacePrefix429 * Get the namespace prefix for a given uri from the <namespaces> object.430 *431 * Returns:432 * {String} A namespace prefix or null if none found.433 */434 getNamespacePrefix: function(uri) {435 var prefix = null;436 if(uri == null) {437 prefix = this.defaultPrefix;438 } else {439 var prefix = null;440 for(var p in this.namespaces) {441 if(this.namespaces[p] == uri) {442 prefix = p;443 break;444 }445 }446 }447 return prefix;448 },449 450 /**451 457 * Method: createElementNSPlus 452 458 * Shorthand for creating namespaced elements with optional attributes and 453 459 * child text nodes. … … 534 540 if(!obj) { 535 541 obj = {}; 536 542 } 537 var prefix = this.getNamespacePrefix(node.namespaceURI); 538 var local = node.nodeName.split(":").pop(); 539 var group = this.readers[prefix]; 543 var group = this.readers[this.namespaceAlias[node.namespaceURI]]; 540 544 if(group) { 545 var local = node.localName || node.nodeName.split(":").pop(); 541 546 var reader = group[local] || group["*"]; 542 547 if(reader) { 543 548 reader.apply(this, [node, obj]); … … 564 569 } 565 570 var children = node.childNodes; 566 571 var child; 567 for(var i=0 ; i<children.length; ++i) {572 for(var i=0, len=children.length; i<len; ++i) { 568 573 child = children[i]; 569 574 if(child.nodeType == 1) { 570 575 this.readNode(child, obj); … … 601 606 local = name.substring(split + 1); 602 607 } else { 603 608 if(parent) { 604 prefix = this. getNamespacePrefix(parent.namespaceURI);609 prefix = this.namespaceAlias[parent.namespaceURI]; 605 610 } else { 606 611 prefix = this.defaultPrefix; 607 612 } -
lib/OpenLayers.js
old new 203 203 "OpenLayers/Format.js", 204 204 "OpenLayers/Format/XML.js", 205 205 "OpenLayers/Format/GML.js", 206 "OpenLayers/Format/GML/Base.js", 207 "OpenLayers/Format/GML/v2.js", 208 "OpenLayers/Format/GML/v3.js", 206 209 "OpenLayers/Format/KML.js", 207 210 "OpenLayers/Format/GeoRSS.js", 208 211 "OpenLayers/Format/WFS.js", -
examples/vector-formats.html
old new 52 52 var in_options = { 53 53 'internalProjection': map.baseLayer.projection, 54 54 'externalProjection': new OpenLayers.Projection(OpenLayers.Util.getElement("inproj").value) 55 } 55 }; 56 56 var out_options = { 57 57 'internalProjection': map.baseLayer.projection, 58 58 'externalProjection': new OpenLayers.Projection(OpenLayers.Util.getElement("outproj").value) 59 } 59 }; 60 var gmlOptions = { 61 featureType: "feature", 62 featureNS: "http://example.com/feature" 63 }; 64 var gmlOptionsIn = OpenLayers.Util.extend( 65 OpenLayers.Util.extend({}, gmlOptions), 66 in_options 67 ); 68 var gmlOptionsOut = OpenLayers.Util.extend( 69 OpenLayers.Util.extend({}, gmlOptions), 70 out_options 71 ); 60 72 formats = { 61 73 'in': { 62 74 wkt: new OpenLayers.Format.WKT(in_options), 63 75 geojson: new OpenLayers.Format.GeoJSON(in_options), 64 76 georss: new OpenLayers.Format.GeoRSS(in_options), 65 gml: new OpenLayers.Format.GML(in_options), 77 gml2: new OpenLayers.Format.GML.v2(gmlOptionsIn), 78 gml3: new OpenLayers.Format.GML.v3(gmlOptionsIn), 66 79 kml: new OpenLayers.Format.KML(in_options) 67 80 }, 68 81 'out': { 69 82 wkt: new OpenLayers.Format.WKT(out_options), 70 83 geojson: new OpenLayers.Format.GeoJSON(out_options), 71 84 georss: new OpenLayers.Format.GeoRSS(out_options), 72 gml: new OpenLayers.Format.GML(out_options), 85 gml2: new OpenLayers.Format.GML.v2(gmlOptionsOut), 86 gml3: new OpenLayers.Format.GML.v3(gmlOptionsOut), 73 87 kml: new OpenLayers.Format.KML(out_options) 74 88 } 75 89 }; … … 169 183 <option value="geojson" selected="selected">GeoJSON</option> 170 184 <option value="kml">KML</option> 171 185 <option value="georss">GeoRSS</option> 172 <option value="gml">GML</option> 186 <option value="gml2">GML (v2)</option> 187 <option value="gml3">GML (v3)</option> 173 188 <option value="wkt">Well-Known Text (WKT)</option> 174 189 </select> 175 190
