1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
|
<html>
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
function test_Format_GML_constructor(t) {
t.plan(4);
var options = {'foo': 'bar'};
var format = new OpenLayers.Format.GML(options);
t.ok(format instanceof OpenLayers.Format.GML,
"new OpenLayers.Format.GML returns object" );
t.eq(format.foo, "bar", "constructor sets options correctly");
t.eq(typeof format.read, "function", "format has a read function");
t.eq(typeof format.write, "function", "format has a write function");
}
function test_Format_GML_getFid(t) {
t.plan(2);
var parser = new OpenLayers.Format.GML();
data = parser.read(test_content[1]);
t.eq(data[0].fid, '221', 'fid on polygons set correctly (with whitespace)');
t.eq(data[1].fid, '8', 'fid on linestrings set correctly with whitespace');
}
function test_Format_GML_no_clobber(t) {
t.plan(1);
var parser = new OpenLayers.Format.GML();
data = parser.read(test_content[1]);
t.eq(window.i, undefined,
"i is undefined in window scope after reading.");
}
function test_Format_GML_read_3d(t) {
t.plan(2);
var parser = new OpenLayers.Format.GML();
data = parser.read(test_content[0]);
t.eq(data[0].geometry.getBounds().toBBOX(), "-1254041.389712,250906.951598,-634517.119991,762236.29408", "Reading 3d content returns geometry with correct bounds (no 0,0)");
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Polygon", "Reading 3d content returns polygon geometry");
}
function test_Format_GML_write_geoms(t) {
t.plan(5);
var parser = new OpenLayers.Format.GML();
var point = shell_start + serialize_geoms['point'] + shell_end;
data = parser.read(point);
var output = parser.write(data);
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, point, "Point geometry round trips correctly.");
var linestring = shell_start + serialize_geoms['linestring'] + shell_end;
data = parser.read(linestring);
var output = parser.write(data);
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, linestring, "Line geometry round trips correctly.");
var polygon = shell_start + serialize_geoms['polygon'] + shell_end;
data = parser.read(polygon);
var output = parser.write(data);
output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, polygon, "Poly geometry round trips correctly.");
var multipoint = shell_start + serialize_geoms['multipoint'] + shell_end;
data = parser.read(multipoint);
var output = parser.write(data);
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, multipoint, "MultiPoint geometry round trips correctly.");
var multilinestring = shell_start + serialize_geoms['multilinestring'] + shell_end;
data = parser.read(multilinestring);
var output = parser.write(data);
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, multilinestring, "MultiLine geometry round trips correctly.");
}
function test_Format_GML_read_point_geom(t) {
t.plan(3);
var point = shell_start + geoms['point'] + shell_end;
var parser = new OpenLayers.Format.GML();
data = parser.read(point);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Point", "Point GML returns correct classname");
t.eq(data[0].geometry.x, 1, "x coord correct");
t.eq(data[0].geometry.y, 2, "y coord correct");
}
function test_Format_GML_read_linestring_geom(t) {
t.plan(5);
var line = shell_start + geoms['linestring'] + shell_end;
var parser = new OpenLayers.Format.GML();
data = parser.read(line);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.LineString", "LineString GML returns correct classname");
t.eq(data[0].geometry.components[0].x, 1, "first x coord correct");
t.eq(data[0].geometry.components[0].y, 2, "first y coord correct");
t.eq(data[0].geometry.components[1].x, 4, "second x coord correct");
t.eq(data[0].geometry.components[1].y, 5, "second y coord correct");
}
function test_Format_GML_read_polygon_geom(t) {
t.plan(7);
var polygon = shell_start + geoms['polygon'] + shell_end;
var parser = new OpenLayers.Format.GML();
data = parser.read(polygon);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Polygon", "Polygon GML returns correct classname");
t.eq(data[0].geometry.components[0].components[0].x, 1, "first x coord correct");
t.eq(data[0].geometry.components[0].components[0].y, 2, "first y coord correct");
t.eq(data[0].geometry.components[0].components[1].x, 4, "second x coord correct");
t.eq(data[0].geometry.components[0].components[1].y, 5, "second y coord correct");
t.eq(data[0].geometry.components[0].components.length, 4, "coords length correct");
t.eq(data[0].geometry.components.length, 1, "rings length correct");
}
function test_Format_GML_read_multipoint_geom(t) {
t.plan(6);
var multipoint = shell_start + geoms['multipoint'] + shell_end;
var parser = new OpenLayers.Format.GML();
data = parser.read(multipoint);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.MultiPoint", "MultiPoint GML returns correct classname");
t.eq(data[0].geometry.components[0].x, 1, "x coord correct");
t.eq(data[0].geometry.components[0].y, 2, "y coord correct");
t.eq(data[0].geometry.components.length, 2, "length correct");
t.eq(data[0].geometry.components[1].x, 4, "x coord correct");
t.eq(data[0].geometry.components[1].y, 5, "y coord correct");
}
function test_Format_GML_read_multilinestring_geom(t) {
t.plan(6);
var multilinestring = shell_start + geoms['multilinestring'] + shell_end;
var parser = new OpenLayers.Format.GML();
data = parser.read(multilinestring);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.MultiLineString", "MultiLineString GML returns correct classname");
t.eq(data[0].geometry.components[0].components[0].x, 1, "x coord correct");
t.eq(data[0].geometry.components[0].components[0].y, 2, "y coord correct");
t.eq(data[0].geometry.components[0].components.length, 2, "length correct");
t.eq(data[0].geometry.components[0].components[1].x, 4, "x coord correct");
t.eq(data[0].geometry.components[0].components[1].y, 5, "y coord correct");
}
function test_Format_GML_read_polygon_with_holes_geom(t) {
t.plan(12);
var polygon_with_holes = shell_start + geoms['polygon_with_holes'] + shell_end;
var parser = new OpenLayers.Format.GML();
data = parser.read(polygon_with_holes);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Polygon", "Polygon GML returns correct classname");
t.eq(data[0].geometry.components[0].components[0].x, 1, "first x coord correct");
t.eq(data[0].geometry.components[0].components[0].y, 2, "first y coord correct");
t.eq(data[0].geometry.components[0].components[1].x, 4, "second x coord correct");
t.eq(data[0].geometry.components[0].components[1].y, 5, "second y coord correct");
t.eq(data[0].geometry.components[0].components.length, 4, "coords length correct");
t.eq(data[0].geometry.components[1].components[0].x, 11, "first x coord correct");
t.eq(data[0].geometry.components[1].components[0].y, 12, "first y coord correct");
t.eq(data[0].geometry.components[1].components[1].x, 14, "second x coord correct");
t.eq(data[0].geometry.components[1].components[1].y, 15, "second y coord correct");
t.eq(data[0].geometry.components[1].components.length, 4, "coords length correct");
t.eq(data[0].geometry.components.length, 2, "rings length correct");
}
function test_Format_GML_read_attributes(t) {
t.plan(3);
var parser = new OpenLayers.Format.GML();
data = parser.read(test_content[0]);
t.eq(data[0].attributes['NAME'], "WY", "Simple Attribute data is read correctly.");
t.eq(data[0].attributes['LONGNAME'], "Wyoming", "Attribute data is read from CDATA node correctly.");
t.ok(data[0].attributes['EMPTYATTR'] === null, "Attribute set to null for empty element.");
}
function test_Format_GML_read_envelope_geom(t) {
t.plan(13);
var envelope = shell_start + geoms['envelope'] + shell_end;
var parser = new OpenLayers.Format.GML();
data = parser.read(envelope);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Polygon", "Envelope GML returns correct classname");
t.eq(data[0].geometry.components[0].components[0].x, 0, "first x coord correct");
t.eq(data[0].geometry.components[0].components[0].y, 1, "first y coord correct");
t.eq(data[0].geometry.components[0].components[1].x, 20, "second x coord correct");
t.eq(data[0].geometry.components[0].components[1].y, 1, "second y coord correct");
t.eq(data[0].geometry.components[0].components[2].x, 20, "third x coord correct");
t.eq(data[0].geometry.components[0].components[2].y, 21, "third y coord correct");
t.eq(data[0].geometry.components[0].components[3].x, 0, "fouth x coord correct");
t.eq(data[0].geometry.components[0].components[3].y, 21, "fourth y coord correct");
t.eq(data[0].geometry.components[0].components[4].x, 0, "fifth x coord correct");
t.eq(data[0].geometry.components[0].components[4].y, 1, "fifth y coord correct");
t.eq(data[0].geometry.components[0].components.length, 5, "coords length correct");
t.eq(data[0].geometry.components.length, 1, "rings length correct");
}
///////////////////////////////////////////////////////////////
// tests the y x order of gml point
/////////////////////////////////////////////////////////////
function test_Format_GML_read_point_geom_yx(t) {
t.plan(3);
var point = shell_start + geoms_yx['point'] + shell_end;
var parser = new OpenLayers.Format.GML({'xy':false});
data = parser.read(point);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Point", "Point GML returns correct classname");
t.eq(data[0].geometry.x, 1, "x coord correct");
t.eq(data[0].geometry.y, 2, "y coord correct");
}
function test_Format_GML_read_linestring_geom_yx(t) {
t.plan(5);
var line = shell_start + geoms_yx['linestring'] + shell_end;
var parser = new OpenLayers.Format.GML({'xy':false});
data = parser.read(line);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.LineString", "LineString GML returns correct classname");
t.eq(data[0].geometry.components[0].x, 1, "first x coord correct");
t.eq(data[0].geometry.components[0].y, 2, "first y coord correct");
t.eq(data[0].geometry.components[1].x, 4, "second x coord correct");
t.eq(data[0].geometry.components[1].y, 5, "second y coord correct");
}
function test_Format_GML_read_polygon_geom_yx(t) {
t.plan(7);
var polygon = shell_start + geoms_yx['polygon'] + shell_end;
var parser = new OpenLayers.Format.GML({'xy':false});
data = parser.read(polygon);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Polygon", "Polygon GML returns correct classname");
t.eq(data[0].geometry.components[0].components[0].x, 1, "first x coord correct");
t.eq(data[0].geometry.components[0].components[0].y, 2, "first y coord correct");
t.eq(data[0].geometry.components[0].components[1].x, 4, "second x coord correct");
t.eq(data[0].geometry.components[0].components[1].y, 5, "second y coord correct");
t.eq(data[0].geometry.components[0].components.length, 4, "coords length correct");
t.eq(data[0].geometry.components.length, 1, "rings length correct");
}
function test_Format_GML_read_multipoint_geom_yx(t) {
t.plan(6);
var multipoint = shell_start + geoms_yx['multipoint'] + shell_end;
var parser = new OpenLayers.Format.GML({'xy':false});
data = parser.read(multipoint);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.MultiPoint", "MultiPoint GML returns correct classname");
t.eq(data[0].geometry.components[0].x, 1, "x coord correct");
t.eq(data[0].geometry.components[0].y, 2, "y coord correct");
t.eq(data[0].geometry.components.length, 2, "length correct");
t.eq(data[0].geometry.components[1].x, 4, "x coord correct");
t.eq(data[0].geometry.components[1].y, 5, "y coord correct");
}
function test_Format_GML_read_multilinestring_geom_yx(t) {
t.plan(6);
var multilinestring = shell_start + geoms_yx['multilinestring'] + shell_end;
var parser = new OpenLayers.Format.GML({'xy':false});
data = parser.read(multilinestring);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.MultiLineString", "MultiLineString GML returns correct classname");
t.eq(data[0].geometry.components[0].components[0].x, 1, "x coord correct");
t.eq(data[0].geometry.components[0].components[0].y, 2, "y coord correct");
t.eq(data[0].geometry.components[0].components.length, 2, "length correct");
t.eq(data[0].geometry.components[0].components[1].x, 4, "x coord correct");
t.eq(data[0].geometry.components[0].components[1].y, 5, "y coord correct");
}
function test_Format_GML_read_polygon_with_holes_geom_yx(t) {
t.plan(12);
var polygon_with_holes = shell_start + geoms_yx['polygon_with_holes'] + shell_end;
var parser = new OpenLayers.Format.GML({'xy':false});
data = parser.read(polygon_with_holes);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Polygon", "Polygon GML returns correct classname");
t.eq(data[0].geometry.components[0].components[0].x, 1, "first x coord correct");
t.eq(data[0].geometry.components[0].components[0].y, 2, "first y coord correct");
t.eq(data[0].geometry.components[0].components[1].x, 4, "second x coord correct");
t.eq(data[0].geometry.components[0].components[1].y, 5, "second y coord correct");
t.eq(data[0].geometry.components[0].components.length, 4, "coords length correct");
t.eq(data[0].geometry.components[1].components[0].x, 11, "first x coord correct");
t.eq(data[0].geometry.components[1].components[0].y, 12, "first y coord correct");
t.eq(data[0].geometry.components[1].components[1].x, 14, "second x coord correct");
t.eq(data[0].geometry.components[1].components[1].y, 15, "second y coord correct");
t.eq(data[0].geometry.components[1].components.length, 4, "coords length correct");
t.eq(data[0].geometry.components.length, 2, "rings length correct");
}
function test_Format_GML_read_envelope_geom_yx(t) {
t.plan(13);
var envelope = shell_start + geoms_yx['envelope'] + shell_end;
var parser = new OpenLayers.Format.GML({'xy':false});
data = parser.read(envelope);
t.eq(data[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Polygon", "Envelope GML returns correct classname");
t.eq(data[0].geometry.components[0].components[0].x, 0, "first x coord correct");
t.eq(data[0].geometry.components[0].components[0].y, 1, "first y coord correct");
t.eq(data[0].geometry.components[0].components[1].x, 20, "second x coord correct");
t.eq(data[0].geometry.components[0].components[1].y, 1, "second y coord correct");
t.eq(data[0].geometry.components[0].components[2].x, 20, "third x coord correct");
t.eq(data[0].geometry.components[0].components[2].y, 21, "third y coord correct");
t.eq(data[0].geometry.components[0].components[3].x, 0, "fouth x coord correct");
t.eq(data[0].geometry.components[0].components[3].y, 21, "fourth y coord correct");
t.eq(data[0].geometry.components[0].components[4].x, 0, "fifth x coord correct");
t.eq(data[0].geometry.components[0].components[4].y, 1, "fifth y coord correct");
t.eq(data[0].geometry.components[0].components.length, 5, "coords length correct");
t.eq(data[0].geometry.components.length, 1, "rings length correct");
}
function test_Format_GML_write_geoms_yx(t) {
t.plan(5);
var parser = new OpenLayers.Format.GML({'xy':false});
var point_xy = shell_start + serialize_geoms['point'] + shell_end;
var point = shell_start + serialize_geoms_yx['point'] + shell_end;
data = parser.read(point);
var output = parser.write(data);
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, point_xy, "Point geometry round trips correctly.");
var linestring_xy = shell_start + serialize_geoms['linestring'] + shell_end;
var linestring = shell_start + serialize_geoms_yx['linestring'] + shell_end;
data = parser.read(linestring);
var output = parser.write(data);
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, linestring_xy, "Line geometry round trips correctly.");
var polygon_xy = shell_start + serialize_geoms['polygon'] + shell_end;
var polygon = shell_start + serialize_geoms_yx['polygon'] + shell_end;
data = parser.read(polygon);
var output = parser.write(data);
output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, polygon_xy, "Poly geometry round trips correctly.");
var multipoint_xy = shell_start + serialize_geoms['multipoint'] + shell_end;
var multipoint = shell_start + serialize_geoms_yx['multipoint'] + shell_end;
data = parser.read(multipoint);
var output = parser.write(data);
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, multipoint_xy, "MultiPoint geometry round trips correctly.");
var multilinestring_xy = shell_start + serialize_geoms['multilinestring'] + shell_end;
var multilinestring = shell_start + serialize_geoms_yx['multilinestring'] + shell_end;
data = parser.read(multilinestring);
var output = parser.write(data);
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
t.eq(output, multilinestring_xy, "MultiLine geometry round trips correctly.");
}
function test_buildGeometryNode_bounds(t) {
t.plan(1);
var parser = new OpenLayers.Format.GML();
var bounds = new OpenLayers.Bounds(-180, -90, 180, 90);
var output, expect;
// test that bounds are written as gml:Box
var output = parser.buildGeometryNode(bounds);
var expect = '<gml:Box xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs="," ts=" ">-180,-90 180,90</gml:coordinates></gml:Box>';
t.xml_eq(output, expect, "[xy true] Bounds correctly written as gml:Box");
}
function test_parseFeatureBox(t) {
t.plan(8);
var parser = new OpenLayers.Format.GML();
var xmlparser = new OpenLayers.Format.XML();
var data = xmlparser.read(test_box[0]);
var feature = parser.parseFeature(data);
t.ok(feature.bounds instanceof OpenLayers.Bounds,
"got bounds object for feature.bounds when with boundedBy Box, without geometry");
t.eq(feature.geometry, null, 'geometry is null for a feature with boundedBy Box, but no geometry');
var data = xmlparser.read(test_box[1]);
feature = parser.parseFeature(data);
t.eq(feature.bounds, null,
"feature is null when without boundedBy Box, with Box geometry");
t.ok(feature.geometry instanceof OpenLayers.Geometry.Polygon,
"got polygon object for feature.geometry when without boundedBy Box, with Box geometry");
data = xmlparser.read(test_box[2]);
feature = parser.parseFeature(data);
t.eq(feature.bounds, null,
"feature.bounds is null when without boundedBy Box, without geometry");
t.eq(feature.geometry, null, 'geometry is null when without boundedBy Box, without geometry');
data = xmlparser.read(test_box[3]);
feature = parser.parseFeature(data);
t.ok(feature.bounds instanceof OpenLayers.Bounds,
"got bounds object for feature.bounds when with boundedBy Box, with Box geometry");
t.ok(feature.geometry instanceof OpenLayers.Geometry.Polygon,
"got polygon object for feature.geometry when with boundedBy Box, with Box geometry");
}
var test_box = [
// with boundedBy Box, without geometry
'<Sentiers_littoraux_feature><gml:boundedBy xmlns:gml="http://www.opengis.net/gml"><gml:Box srsName="EPSG:2154"><gml:coordinates>143564.081753,6817901.121957 144209.641321,6819104.781451</gml:coordinates></gml:Box></gml:boundedBy><DEPARTEMENT>Finistère</DEPARTEMENT></Sentiers_littoraux_feature>',
// without boundedBy Box, with Box geometry
'<Sentiers_littoraux_feature><msGeometry><gml:Box srsName="EPSG:2154" xmlns:gml="http://www.opengis.net/gml"><gml:coordinates>143564.081753,6817901.121957 144209.641321,6819104.781451</gml:coordinates></gml:Box></msGeometry><DEPARTEMENT>Finistère</DEPARTEMENT></Sentiers_littoraux_feature>',
// without boundedBy, without geometry
'<Sentiers_littoraux_feature><DEPARTEMENT>Finistère</DEPARTEMENT></Sentiers_littoraux_feature>',
// with boundedBy Box, with Box geometry
'<Sentiers_littoraux_feature><msGeometry><gml:Box srsName="EPSG:2154" xmlns:gml="http://www.opengis.net/gml"><gml:coordinates>143564.081753,6817901.121957 144209.641321,6819104.781451</gml:coordinates></gml:Box></msGeometry><gml:boundedBy xmlns:gml="http://www.opengis.net/gml"><gml:Box srsName="EPSG:2154"><gml:coordinates>143564.081753,6817901.121957 144209.641321,6819104.781451</gml:coordinates></gml:Box></gml:boundedBy><DEPARTEMENT>Finistère</DEPARTEMENT></Sentiers_littoraux_feature>'];
var test_content = ['<?xml version="1.0" encoding="utf-8" ?>\n<ogr:FeatureCollection\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n xsi:schemaLocation="http://ogr.maptools.org/ testoutput.xsd"\n xmlns:ogr="http://ogr.maptools.org/"\n xmlns:gml="http://www.opengis.net/gml">\n <gml:boundedBy>\n <gml:Box>\n <gml:coord><gml:X>-1254041.389711702</gml:X><gml:Y>250906.9515983529</gml:Y></gml:coord>\n <gml:coord><gml:X>-634517.1199908922</gml:X><gml:Y>762236.2940800377</gml:Y></gml:coord>\n </gml:Box>\n </gml:boundedBy> \n <gml:featureMember>\n <ogr:states fid="F0">\n <ogr:geometryProperty><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-634517.11999089224,691849.77929356066,0 -653761.64509297756,471181.53429472551,0 -673343.60852865304,250906.9515983529,0 -1088825.734430399,299284.85108220269,0 -1254041.3897117018,324729.27754874947,0 -1235750.4212498858,434167.33911316615,0 -1190777.7803201093,704392.96327195223,0 -1181607.835811228,762236.29408003774,0 -634517.11999089224,691849.77929356066,0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>\n <ogr:NAME>WY</ogr:NAME>\n <ogr:EMPTYATTR/><ogr:LONGNAME><![CDATA[Wyoming]]></ogr:LONGNAME>\n </ogr:states>\n </gml:featureMember>\n</ogr:FeatureCollection>\n',
'<wfs:FeatureCollection' +
' xmlns:fs="http://example.com/featureserver"' +
' xmlns:wfs="http://www.opengis.net/wfs"' +
' xmlns:gml="http://www.opengis.net/gml"' +
' xmlns:ogc="http://www.opengis.net/ogc"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengeospatial.net//wfs/1.0.0/WFS-basic.xsd">' +
' ' +
'' +
' <gml:featureMember>' +
' \n<fs:scribble fid="221">' +
' <fs:geometry>' +
' <gml:Polygon>' +
' ' +
' <gml:outerBoundaryIs><gml:LinearRing>' +
' <gml:coordinates>149.105072021,-35.1816558838 149.100608826,-35.1844024658 149.098892212,-35.1898956299 149.105072021,-35.1816558838</gml:coordinates>' +
' </gml:LinearRing></gml:outerBoundaryIs>' +
' ' +
' </gml:Polygon>' +
' </fs:geometry>' +
' <fs:title>random test features</fs:title>' +
' </fs:scribble>' +
'</gml:featureMember> ' +
' <gml:featureMember><fs:scribble fid="8"> <fs:geometry> <gml:Point><gml:coordinates>-81.38671875,27.0703125</gml:coordinates></gml:Point> </fs:geometry> ' +
' <fs:down>south</fs:down><fs:title>Florida</fs:title> </fs:scribble></gml:featureMember>' +
'</wfs:FeatureCollection>'
];
var shell_start = '<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMember xmlns:gml="http://www.opengis.net/gml"><feature:features xmlns:feature="http://mapserver.gis.umn.edu/mapserver" fid="221"><feature:geometry>';
if (OpenLayers.BROWSER_NAME == "opera") {
shell_start = '<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMember xmlns:gml="http://www.opengis.net/gml"><feature:features fid="221" xmlns:feature="http://mapserver.gis.umn.edu/mapserver"><feature:geometry>';
}
var shell_end = '</feature:geometry></feature:features></gml:featureMember></wfs:FeatureCollection>';
var serialize_geoms = {
'point': '<gml:Point><gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates></gml:Point>',
'linestring': '<gml:LineString><gml:coordinates decimal="." cs="," ts=" ">1,2 4,5</gml:coordinates></gml:LineString>',
'polygon': '<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates decimal="." cs="," ts=" ">1,2 4,5 3,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>',
'multipoint': '<gml:MultiPoint><gml:pointMember><gml:Point><gml:coordinates decimal="." cs="," ts=" ">1,2</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates decimal="." cs="," ts=" ">4,5</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint>',
'multilinestring': '<gml:MultiLineString><gml:lineStringMember><gml:LineString><gml:coordinates decimal="." cs="," ts=" ">1,2 4,5</gml:coordinates></gml:LineString></gml:lineStringMember><gml:lineStringMember><gml:LineString><gml:coordinates decimal="." cs="," ts=" ">11,12 14,15</gml:coordinates></gml:LineString></gml:lineStringMember></gml:MultiLineString>'
};
var geoms = {
'point': '<gml:Point><gml:coordinates>1,2,3</gml:coordinates></gml:Point>',
'linestring': '<gml:LineString><gml:coordinates>1,2,3 4,5,6</gml:coordinates></gml:LineString>',
'polygon': '<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 4,5 3,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>',
'polygon_with_holes': '<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 4,5 3,6 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>11,12 14,15 13,16 11,12</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>',
'multipoint': '<gml:MultiPoint><gml:Point><gml:coordinates>1,2,3</gml:coordinates></gml:Point><gml:Point><gml:coordinates>4,5,6</gml:coordinates></gml:Point></gml:MultiPoint>',
'multilinestring': '<gml:MultiLineString><gml:LineString><gml:coordinates>1,2,3 4,5,6</gml:coordinates></gml:LineString><gml:LineString><gml:coordinates>11,12,13 14,15,16</gml:coordinates></gml:LineString></gml:MultiLineString>',
'envelope': '<gml:Envelope><gml:lowerCorner>0 1</gml:lowerCorner><gml:upperCorner>20 21</gml:upperCorner></gml:Envelope>' // ,
// 'multipolygon_with_holes': '<gml:MultiPolygon><gml:Polygon><gml:outerBoundaryIs>1,2 4,5 3,6 1,2</gml:outerBoundaryIs><gml:innerBoundaryIs>11,12 14,15 13,16 11,12</gml:innerBoundaryIs></gml:Polygon><gml:Polygon><gml:outerBoundaryIs>101,102 104,105 103,106 101,102</gml:outerBoundaryIs><gml:innerBoundaryIs>111,112 114,115 113,116 111,112</gml:innerBoundaryIs></gml:Polygon></gml:MultiPolygon>'
};
//
// The following data has the (x y) reordered to (y x), in 3 dimensions it goes from (x y z) to (y x z)
//
var serialize_geoms_yx = {
'point': '<gml:Point><gml:coordinates decimal="." cs="," ts=" ">2,1</gml:coordinates></gml:Point>',
'linestring': '<gml:LineString><gml:coordinates decimal="." cs="," ts=" ">2,1 5,4</gml:coordinates></gml:LineString>',
'polygon': '<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates decimal="." cs="," ts=" ">2,1 5,4 6,3 2,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>',
'multipoint': '<gml:MultiPoint><gml:pointMember><gml:Point><gml:coordinates decimal="." cs="," ts=" ">2,1</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates decimal="." cs="," ts=" ">5,4</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint>',
'multilinestring': '<gml:MultiLineString><gml:lineStringMember><gml:LineString><gml:coordinates decimal="." cs="," ts=" ">2,1 5,4</gml:coordinates></gml:LineString></gml:lineStringMember><gml:lineStringMember><gml:LineString><gml:coordinates decimal="." cs="," ts=" ">12,11 15,14</gml:coordinates></gml:LineString></gml:lineStringMember></gml:MultiLineString>'
};
var geoms_yx = {
'point': '<gml:Point><gml:coordinates>2,1,3</gml:coordinates></gml:Point>',
'linestring': '<gml:LineString><gml:coordinates>2,1,3 5,4,6</gml:coordinates></gml:LineString>',
'polygon': '<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,1 5,4 6,3 2,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>',
'polygon_with_holes': '<gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,1 5,4 6,3 2,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>12,11 15,14 16,13 12,11</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>',
'multipoint': '<gml:MultiPoint><gml:Point><gml:coordinates>2,1,3</gml:coordinates></gml:Point><gml:Point><gml:coordinates>5,4,6</gml:coordinates></gml:Point></gml:MultiPoint>',
'multilinestring': '<gml:MultiLineString><gml:LineString><gml:coordinates>2,1,3 5,4,6</gml:coordinates></gml:LineString><gml:LineString><gml:coordinates>12,11,13 15,14,16</gml:coordinates></gml:LineString></gml:MultiLineString>',
'envelope': '<gml:Envelope><gml:lowerCorner>1 0</gml:lowerCorner><gml:upperCorner>21 20</gml:upperCorner></gml:Envelope>'
};
</script>
</head>
<body>
</body>
</html>
|