diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index 9c55d8ceac..93b7a49b87 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -2185,7 +2185,8 @@ ol.format.KML.writeCoordinatesTextNode_ = ol.format.KML.writeDocument_ = function(node, features, objectStack) { var /** @type {ol.xml.NodeStackItem} */ context = {node: node}; ol.xml.pushSerializeAndPop(context, ol.format.KML.DOCUMENT_SERIALIZERS_, - ol.format.KML.DOCUMENT_NODE_FACTORY_, features, objectStack); + ol.format.KML.DOCUMENT_NODE_FACTORY_, features, objectStack, undefined, + this); }; diff --git a/test/spec/ol/format/kmlformat.test.js b/test/spec/ol/format/kmlformat.test.js index 440df02a3a..dd333ec30e 100644 --- a/test/spec/ol/format/kmlformat.test.js +++ b/test/spec/ol/format/kmlformat.test.js @@ -1915,6 +1915,43 @@ describe('ol.format.KML', function() { ''; expect(node).to.xmleql(ol.xml.parse(text)); }); + + it('can write multiple features with Style', function() { + var style = new ol.style.Style({ + fill: new ol.style.Fill({ + color: 'rgba(12, 34, 223, 0.7)' + }) + }); + var feature = new ol.Feature(); + feature.setStyle(style); + var feature2 = new ol.Feature(); + feature2.setStyle(style); + var node = format.writeFeaturesNode([feature, feature2]); + var text = + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ''; + expect(node).to.xmleql(ol.xml.parse(text)); + }); }); describe('style maps', function() {