makinacorpus / Leaflet.FileLayer

Loads files locally (GeoJSON, KML, GPX) as layers using HTML5 File API
http://makinacorpus.github.io/Leaflet.FileLayer/
MIT License
273 stars 91 forks source link

Remove added layer #61

Open tmamedzadeh opened 6 years ago

tmamedzadeh commented 6 years ago

Is there a way to remove the added layer, without removing other polygons and markers?

johnd0e commented 5 years ago

Sure there is. The easiest method is using Layers control.

  var layerswitcher = L.control.layers().addTo(map);
  var control = L.Control.fileLayerLoad().addTo(map);

  control.loader.on('data:loaded', function (e) {
    layerswitcher.addOverlay(e.layer, e.filename);
  });