Open amirsamani opened 2 years ago
Does anyone know how this is done?
This code snippet could help you to remove the added layer from the map. If you click on the map, the just-added layer will be removed. Or you can introduce a button in HTML and write a Jquery.
HTML:
JS: //remove and add layer on clicking checkbox vt_layer using jquery $("#vt_layer").click(function () { if (this.checked) { map.addLayer(bandar_asphalt); } else { map.removeLayer(bandar_asphalt); } } );
Without using JQuery: MAP.on("click", function (e) { if (map.hasLayer(bandar_asphalt)) { map.removeLayer(bandar_asphalt); } });
hi I have added a layer to the map with below code and after I want to remove that layer from the map, how can I do this?