Currently trying to use the following code to add and remove Legends as a result of an overlay being added to the map. Getting no error messages in browser but still doesn't seem to be working.
map.on('overlayadd', function (eventLayer) {
if (eventLayer.name === 'Bombing') {
BombingL.addTo(map);
map.removeControl(ArmedAssaultL);
} else {
map.removeControl(ArmedAssaultL);
}
});
in this case I'm trying to say that when a layer is added to the map called 'Bombing', also add the bombing layer legend (BombingL) and remove the Armed Assault Layer legend (Armed AssaultL)
If there is nothing wrong with that code i'll try and get a jsfiddle working to evidence it better.
ArmedAssaultL
control seems to be never brought back. Could you kindly explain what "doesn't seem to be working"?