Leaflet.KMLGroundOverlay kmz 1

Leaflet.KMLGroundOverlay kmz

  var track = new L.KML('Coventry.kml', {async: true})
.on('loaded', function (e) {
    map.fitBounds(e.target.getBounds());
})
.addTo(map);
  L.control.layers({}, {'Track':track}).addTo(map);

Here is what the above code is Doing:
1. We create a new Leaflet map widget, using the default basemap tiles.
2. We add a new KML layer to the map, using the URL of the KML file we uploaded to GitHub.
3. We add a control to the map that allows the user to toggle the KML layer on and off.
4. We add the map to the page.

Similar Posts