[GIS] Remove layer switcher controller in leaflet

leaflet

I have created a map in leaflet and added an overlay as:

map.layerscontrol.addOverlay(tile_layer,"{{ resource.title }}");
map.addLayer(tile_layer);

The map shows great and the layer as well.
Now I want to remove the 'layer switcher' controller.
How can I do that in Leaflet?

Best Answer

All controls in Leaflet should inherit the removeFrom method, so to remove your existing layerscontrol, you can use:

map.layerscontrol.removeFrom(map);