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

How to remove the FileLAyer control on map? #23

Closed mahmoudmy closed 8 years ago

mahmoudmy commented 8 years ago

I tried to remove the created fileLayer control by using fileLayer.removeFrom(map), but it doesn't work! Any idea?

leplatrem commented 8 years ago

You are right, it looks like the remove function were not implemented :)

Feel free to open a pull-request to add those! It should not be extremely complex, but don't hesitate to submit a draft so that we can help you

SBats commented 8 years ago

Hi @mahmoudmy ! Thank you for the feedback. I'm cleaning and improving a bit this plugin. Is this issue still true ? I've just conducted some tests and in my case, it seems working just fine.

    ...
    var control = L.Control.fileLayerLoad(options).addTo(map);
    setTimeout(function () {
        control.removeFrom(map);
    }, 2000);

Could you please confirm ?

mahmoudmy commented 8 years ago

Hi @SBats , Thanks. Yes, it's OK!

SBats commented 8 years ago

Ok great ! Thanks for answering !