I use https://github.com/geocodezip/geoxml3 in order to visualize kml files on Google Maps and it works well, but I would like to change the style of lines, to dotted, or dashed. I've tried that after the kml file is parsed with:
function drawRoute(array,color,stringNumber){
if (typeof myParser != "undefined") {
myParser.parse(array); //array is local kml file
}
else{
var myParser = new geoXML3.parser({map: map});
myParser.parse(array);
}
var lineSymbol = {
path: 'M 0,0 0,0',
strokeOpacity: 1,
scale: 4
};
for (var i = 0; i < myParser.docs[0].gpolylines.length; i++){
myParser.docs[0].gpolylines[i].setOptions({
strokeOpacity: 0,
icons: [{
icon: lineSymbol,
offset: '0',
repeat: '20px'
}]
});
Any type of help appreciated.
Thanks in advance.
Edit: Updated question with whole function + the docs[0], which throws undefined.
You need to (as you say in your question) wait until after the kml file is parsed (using a "parsed" event listener or "afterParse" function).
proof of concept fiddle
code snippet: