Thursday 15 May 2014

javascript - Leaflet Omnivore KML, style imported paths -



javascript - Leaflet Omnivore KML, style imported paths -

i'm trying import multiple kml files , style them. code now:

var comuni = new array(); (var = nearby.comuni.length - 1; >= 0; i--) { var c = nearby.comuni[i].colore; comune = omnivore.kml(nearby.comuni[i].kml); comune.setstyle({color: c}); comuni.push(comune); }; var comunilayer = l.layergroup(comuni);

all variables instanced correctly, kmls converted , added map, fill , stroke colors default blue. "c" var contains hex color code. missing?

i kindly helped on github https://github.com/tmcw

the setstyle code had called synchrounsly this:

comune.on('ready', function() { this.setstyle({color: "#ff0000"}); });

full illustration on fiddle: http://jsfiddle.net/oxdnpzcr/3/

javascript kml leaflet mapbox

No comments:

Post a Comment