Geographic Information Systems Asked on May 5, 2021
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?
All controls in Leaflet should inherit the removeFrom
method, so to remove your existing layerscontrol
, you can use:
map.layerscontrol.removeFrom(map);
Correct answer by nathansnider on May 5, 2021
Current versions of leaflet do not add a L.Control.Layers
to the map by default. I suggest you check if you're using a recent version, and check if you are manually adding a layers control somewhere.
Answered by IvanSanchez on May 5, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP