Raruto / leaflet-kmz

A KMZ file loader for Leaflet Maps
GNU General Public License v3.0
49 stars 27 forks source link

Expose `KMZLayer.parse` function for FileReader usage #29

Closed meihuisu closed 1 year ago

meihuisu commented 2 years ago

This allows uploading of local kml/kmz file with FileReader

function uploadKMZFile(urls) {
  var reader = new FileReader();
  reader.onload = function(event) {
      var result = reader.result;
      var kmz = L.kmzLayer().addTo(map);
      kmz.parse(result, { name: urls[0].name, icons: {} });
  };
  reader.readAsArrayBuffer(urls[0]);
}
Raruto commented 1 year ago

Patch released in version 1.0.9