In leaflet I'm trying to get a function going that when a user clicks on a certain (image)layer in the layer control panel and it sees that a conflicting layer is on, it turns the conflicting layer off and also turns it off in the layer control panel,
map.on('overlayadd', function(e) {
switch(e.layer){
case s2: if(map.hasLayer(s3)){map.removeLayer(s3);}
break;
case s3: if(map.hasLayer(s2)){map.removeLayer(s2);}
break;
default: break;
}
var overlays = {
"A": s1,
"B": s5,
"C": s6,
"D": s2,
"E": s3,
"F": s4,
"G": s7,
};
L.control.layers(baseLayers,overlays,{collapsed:false}).addTo(map);