diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index ad6910ef7a..ca4dec28a4 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -1369,7 +1369,9 @@ ol.format.KML.PLACEMARK_PARSERS_ = ol.xml.makeParsersNS( }, ol.xml.makeParsersNS( ol.format.KML.GX_NAMESPACE_URIS_, { 'MultiTrack': ol.xml.makeObjectPropertySetter( - ol.format.KML.readGxMultiTrack_, 'geometry') + ol.format.KML.readGxMultiTrack_, 'geometry'), + 'Track': ol.xml.makeObjectPropertySetter( + ol.format.KML.readGxTrack_, 'geometry') } )); diff --git a/test/spec/ol/format/kmlformat.test.js b/test/spec/ol/format/kmlformat.test.js index 68ec2c5007..77609b60be 100644 --- a/test/spec/ol/format/kmlformat.test.js +++ b/test/spec/ol/format/kmlformat.test.js @@ -321,6 +321,58 @@ describe('ol.format.KML', function() { expect(gs[0]).to.be.an(ol.geom.GeometryCollection); }); + it('can read gx:Track', function() { + var text = + '' + + ' ' + + ' ' + + ' 2014-01-06T19:38:55Z' + + ' 2014-01-06T19:39:03Z' + + ' 2014-01-06T19:39:10Z' + + ' 8.1 46.1 1909.9' + + ' 8.2 46.2 1925.2' + + ' 8.3 46.3 1926.2' + + ' ' + + ' ' + + ''; + var fs = format.readFeatures(text); + expect(fs).to.have.length(1); + var f = fs[0]; + expect(f).to.be.an(ol.Feature); + var g = f.getGeometry(); + expect(g).to.be.an(ol.geom.LineString); + }); + + it('can read gx:MultiTrack', function() { + var text = + '' + + ' ' + + ' ' + + ' ' + + ' 2014-01-06T19:38:55Z' + + ' 8.1 46.1 1909.9' + + ' ' + + ' ' + + ' 2014-01-06T19:38:55Z' + + ' 2014-01-06T19:39:10Z' + + ' 8.1 46.1 1909.9' + + ' 8.2 46.2 1925.2' + + ' ' + + ' ' + + ' ' + + ''; + var fs = format.readFeatures(text); + expect(fs).to.have.length(1); + var f = fs[0]; + expect(f).to.be.an(ol.Feature); + var g = f.getGeometry(); + expect(g).to.be.an(ol.geom.MultiLineString); + var gs = g.getLineStrings(); + expect(gs).to.have.length(2); + expect(gs[0]).to.be.an(ol.geom.LineString); + }); }); describe('attributes', function() {