0

I am working with google maps and using geoxml3 to parse my kml string and its showing on Google maps , now I want to get lines info like number of lines in kml string and its location can i get the info of lines drawn by parsed kml string?

html

<div id="map" style="height: 720px"></div>

app.ts

function parseKml() {

    var myParser = new geoXML3.parser({map: map});
    myParser.parseKmlString(kmlString);


  }
Kumail Hussain
  • 869
  • 2
  • 26
  • 49

2 Answers2

1

you can also get path from kml like this :

var myParser = new geoXML3.parser({
    map: map, //your map
    afterParse: function(doc) { // callback after parse
        for (var i = 0; i < doc[0].placemarks.length; i++) {                
            console.log(doc[0].placemarks[i].LineString[0].coordinates) //for coordinates - doc[0].placemarks[i] get more info
        }
    }
});
myParser.parse('http://googlemaps.github.io/js-v2-samples/ggeoxml/cta.kml');

for example

0

we can get description related to kml string/file by :

myParser.docs[0].placemarks[0]
myParser.docs[0].placemarks[1]
myParser.docs[0].placemarks[2]

use it accordingly as I have three lines

Kumail Hussain
  • 869
  • 2
  • 26
  • 49