Create valid KML documents

Thanks @bartvde.
This commit is contained in:
Éric Lemoine
2014-06-25 15:56:41 +02:00
parent 05970c9831
commit 384f2a0ecf
2 changed files with 174 additions and 39 deletions
+19 -3
View File
@@ -163,6 +163,17 @@ ol.format.KML.NAMESPACE_URIS_ = [
]; ];
/**
* @const
* @type {Array.<string>}
* @private
*/
ol.format.KML.XSD_URIS_ = [
'http://www.opengis.net/kml/2.2',
'https://developers.google.com/kml/schema/kml22gx.xsd'
];
/** /**
* @const * @const
* @type {ol.Color} * @type {ol.Color}
@@ -2516,9 +2527,14 @@ ol.format.KML.prototype.writeFeatures;
* @inheritDoc * @inheritDoc
*/ */
ol.format.KML.prototype.writeFeaturesNode = function(features) { ol.format.KML.prototype.writeFeaturesNode = function(features) {
var kml = ol.xml.createElementNS('http://earth.google.com/kml/2.2', 'kml'); var kml = ol.xml.createElementNS('http://www.opengis.net/kml/2.2', 'kml');
kml.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:gx', var xmlnsUri = 'http://www.w3.org/2000/xmlns/';
ol.format.KML.GX_NAMESPACE_URIS_[0]); var xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance';
kml.setAttributeNS(xmlnsUri, 'xmlns:gx', ol.format.KML.GX_NAMESPACE_URIS_[0]);
kml.setAttributeNS(xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri);
kml.setAttributeNS(xmlSchemaInstanceUri, 'xsi:schemaLocation',
ol.format.KML.XSD_URIS_.join(' '));
var /** @type {ol.xml.NodeStackItem} */ context = {node: kml}; var /** @type {ol.xml.NodeStackItem} */ context = {node: kml};
var properties = {}; var properties = {};
if (features.length > 1) { if (features.length > 1) {
+155 -36
View File
@@ -40,7 +40,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature()]; var features = [new ol.Feature()];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark/>' + ' <Placemark/>' +
'</kml>'; '</kml>';
expect(node).to.xmleql(ol.xml.load(text)); expect(node).to.xmleql(ol.xml.load(text));
@@ -52,7 +56,11 @@ describe('ol.format.KML', function() {
var features = [feature]; var features = [feature];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark id="foo"/>' + ' <Placemark id="foo"/>' +
'</kml>'; '</kml>';
expect(node).to.xmleql(ol.xml.load(text)); expect(node).to.xmleql(ol.xml.load(text));
@@ -79,7 +87,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(null)]; var features = [new ol.Feature(null)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark/>' + ' <Placemark/>' +
'</kml>'; '</kml>';
expect(node).to.xmleql(ol.xml.load(text)); expect(node).to.xmleql(ol.xml.load(text));
@@ -87,7 +99,11 @@ describe('ol.format.KML', function() {
it('can read Point geometries', function() { it('can read Point geometries', function() {
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Point>' + ' <Point>' +
' <coordinates>1,2,3</coordinates>' + ' <coordinates>1,2,3</coordinates>' +
@@ -109,7 +125,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(point)]; var features = [new ol.Feature(point)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Point>' + ' <Point>' +
' <coordinates>1,2</coordinates>' + ' <coordinates>1,2</coordinates>' +
@@ -125,7 +145,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(point)]; var features = [new ol.Feature(point)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Point>' + ' <Point>' +
' <coordinates>1,2,3</coordinates>' + ' <coordinates>1,2,3</coordinates>' +
@@ -141,7 +165,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(point)]; var features = [new ol.Feature(point)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Point>' + ' <Point>' +
' <coordinates>1,2</coordinates>' + ' <coordinates>1,2</coordinates>' +
@@ -157,7 +185,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(point)]; var features = [new ol.Feature(point)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Point>' + ' <Point>' +
' <coordinates>1,2,3</coordinates>' + ' <coordinates>1,2,3</coordinates>' +
@@ -191,7 +223,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(lineString)]; var features = [new ol.Feature(lineString)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <LineString>' + ' <LineString>' +
' <coordinates>1,2 3,4</coordinates>' + ' <coordinates>1,2 3,4</coordinates>' +
@@ -208,7 +244,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(lineString)]; var features = [new ol.Feature(lineString)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <LineString>' + ' <LineString>' +
' <coordinates>1,2,3 4,5,6</coordinates>' + ' <coordinates>1,2,3 4,5,6</coordinates>' +
@@ -225,7 +265,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(lineString)]; var features = [new ol.Feature(lineString)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <LineString>' + ' <LineString>' +
' <coordinates>1,2 3,4</coordinates>' + ' <coordinates>1,2 3,4</coordinates>' +
@@ -242,7 +286,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(lineString)]; var features = [new ol.Feature(lineString)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <LineString>' + ' <LineString>' +
' <coordinates>1,2,3 4,5,6</coordinates>' + ' <coordinates>1,2,3 4,5,6</coordinates>' +
@@ -277,7 +325,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(linearRing)]; var features = [new ol.Feature(linearRing)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <LinearRing>' + ' <LinearRing>' +
' <coordinates>1,2 3,4 1,2</coordinates>' + ' <coordinates>1,2 3,4 1,2</coordinates>' +
@@ -294,7 +346,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(linearRing)]; var features = [new ol.Feature(linearRing)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <LinearRing>' + ' <LinearRing>' +
' <coordinates>1,2,3 4,5,6 1,2,3</coordinates>' + ' <coordinates>1,2,3 4,5,6 1,2,3</coordinates>' +
@@ -311,7 +367,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(linearRing)]; var features = [new ol.Feature(linearRing)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <LinearRing>' + ' <LinearRing>' +
' <coordinates>1,2 3,4 1,2</coordinates>' + ' <coordinates>1,2 3,4 1,2</coordinates>' +
@@ -328,7 +388,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(linearRing)]; var features = [new ol.Feature(linearRing)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <LinearRing>' + ' <LinearRing>' +
' <coordinates>1,2,3 4,5,6 1,2,3</coordinates>' + ' <coordinates>1,2,3 4,5,6 1,2,3</coordinates>' +
@@ -368,7 +432,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(polygon)]; var features = [new ol.Feature(polygon)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Polygon>' + ' <Polygon>' +
' <outerBoundaryIs>' + ' <outerBoundaryIs>' +
@@ -389,7 +457,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(polygon)]; var features = [new ol.Feature(polygon)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Polygon>' + ' <Polygon>' +
' <outerBoundaryIs>' + ' <outerBoundaryIs>' +
@@ -412,7 +484,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(polygon)]; var features = [new ol.Feature(polygon)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Polygon>' + ' <Polygon>' +
' <outerBoundaryIs>' + ' <outerBoundaryIs>' +
@@ -436,7 +512,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(polygon)]; var features = [new ol.Feature(polygon)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Polygon>' + ' <Polygon>' +
' <outerBoundaryIs>' + ' <outerBoundaryIs>' +
@@ -494,7 +574,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(polygon)]; var features = [new ol.Feature(polygon)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Polygon>' + ' <Polygon>' +
' <innerBoundaryIs>' + ' <innerBoundaryIs>' +
@@ -548,7 +632,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(multiPoint)]; var features = [new ol.Feature(multiPoint)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <MultiGeometry>' + ' <MultiGeometry>' +
' <Point>' + ' <Point>' +
@@ -594,7 +682,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(multiLineString)]; var features = [new ol.Feature(multiLineString)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <MultiGeometry>' + ' <MultiGeometry>' +
' <LineString>' + ' <LineString>' +
@@ -650,7 +742,11 @@ describe('ol.format.KML', function() {
var features = [new ol.Feature(multiPolygon)]; var features = [new ol.Feature(multiPolygon)];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <MultiGeometry>' + ' <MultiGeometry>' +
' <Polygon>' + ' <Polygon>' +
@@ -925,7 +1021,11 @@ describe('ol.format.KML', function() {
var features = [feature]; var features = [feature];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <address>My address</address>' + ' <address>My address</address>' +
' <description>My description</description>' + ' <description>My description</description>' +
@@ -943,7 +1043,11 @@ describe('ol.format.KML', function() {
var features = [feature]; var features = [feature];
var node = format.writeFeatures(features); var node = format.writeFeatures(features);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2">' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <open>1</open>' + ' <open>1</open>' +
' <visibility>0</visibility>' + ' <visibility>0</visibility>' +
@@ -1339,8 +1443,11 @@ describe('ol.format.KML', function() {
feature.setStyle([style]); feature.setStyle([style]);
var node = format.writeFeatures([feature]); var node = format.writeFeatures([feature]);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2"' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2">' + ' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Style>' + ' <Style>' +
' <IconStyle>' + ' <IconStyle>' +
@@ -1376,8 +1483,11 @@ describe('ol.format.KML', function() {
feature.setStyle([style]); feature.setStyle([style]);
var node = format.writeFeatures([feature]); var node = format.writeFeatures([feature]);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2"' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2">' + ' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Style>' + ' <Style>' +
' <LabelStyle>' + ' <LabelStyle>' +
@@ -1402,8 +1512,11 @@ describe('ol.format.KML', function() {
feature.setStyle([style]); feature.setStyle([style]);
var node = format.writeFeatures([feature]); var node = format.writeFeatures([feature]);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2"' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2">' + ' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Style>' + ' <Style>' +
' <LineStyle>' + ' <LineStyle>' +
@@ -1426,8 +1539,11 @@ describe('ol.format.KML', function() {
feature.setStyle([style]); feature.setStyle([style]);
var node = format.writeFeatures([feature]); var node = format.writeFeatures([feature]);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2"' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2">' + ' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' + ' <Placemark>' +
' <Style>' + ' <Style>' +
' <PolyStyle>' + ' <PolyStyle>' +
@@ -1918,8 +2034,11 @@ describe('ol.format.KML', function() {
feature2.setId('2'); feature2.setId('2');
var node = format.writeFeatures([feature1, feature2]); var node = format.writeFeatures([feature1, feature2]);
var text = var text =
'<kml xmlns="http://earth.google.com/kml/2.2" ' + '<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2">' + ' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Document>' + ' <Document>' +
' <Placemark id="1">' + ' <Placemark id="1">' +
' </Placemark>' + ' </Placemark>' +