Skip to content
🌎Leaflet KML layer plugin
Branch: master
Clone or download
Ivo Lukacovic
Ivo Lukacovic v1.0.1
Latest commit 9dfc535 Jun 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets Initial commit May 30, 2019
L.KML.js Initial commit May 30, 2019 v1.0.1 Jun 16, 2019
package.json v1.0.1 Jun 16, 2019

Leaflet KML layer plugin



This plugin was extracted from Pavel Shramov's Leaflet Plugins repository in order to maintain this code more frequently and separate KML layer from other plugins.

So far we have fixed few issues.

Probablly will work on Leaflet 1+, tested on Leaflet 1.4.

How to use

   <link rel="stylesheet" href="" />
   <script src=""></script>
   <script src="./L.KML.js"></script>
   <div style="width:100%; height:100%" id="map"></div>
   <script type='text/javascript'>

   	// Make basemap
   	const map = new L.Map('map', {center: new L.LatLng(58.4, 43.0), zoom: 11})
   	, osm = new L.TileLayer('http://{s}{z}/{x}/{y}.png')


   	// Load kml file
   		  .then( res => response.text() )
   		  .then( kml => {

   			  	// Create new kml overlay
   				const track = new L.KML(kml)

   				// Adjust map to show the kml
   				const bounds = track.getBounds()
   				map.fitBounds( bounds )




  • 1.0.1 - Updated README
  • 1.0.0 - Initial commit, original version with few fixes



You can’t perform that action at this time.