Answer the question
In order to leave comments, you need to log in
How to display labels from KML in separate layers in leaflet?
There is KML with traffic route marking
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" >
<Folder id="results">
<name>trace name</name>
<Style id="dir_step"></Style>
<Placemark id="26.1.1"></Placemark>
<Placemark id="26.1.2"></Placemark>
<Folder id="26"></Folder>
<Folder id="27"></Folder>
<Folder id="28"></Folder>
<Folder id="29"></Folder>
</Folder>
</kml>
function init(){
var map = L.map('map').setView([55.826797, 49.130057], 11);
L.tileLayer('map/{z}/{x}/{y}.png', {
minZoom: 10,
maxZoom: 18
}).addTo(map);
var track = new L.KML("kml/rathaus_trans.kml", {async: true});
track.on("loaded", function(e) {
map.fitBounds(e.target.getBounds());
});
map.addLayer(track);
map.addControl(new L.Control.Layers({}, {'Track':track}));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question