chosenlayer = {
NumScreenLayer.remove();
NumHighCountLayer.remove();
PCTHighCountLayer.remove();
if (choice == "Number Screened"){
NumScreenLayer.addTo(map);
var legend = L.control({position: 'bottomright'});
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info legend'),
grades = [50, 250, 500, 1000, 1500, 2000],
labels = ["50-250", "251-500","501-1000","1001-1500","1500+"];
for (var i = 0; i < grades.length; i++) {
div.innerHTML +=
'<i style="background:' + screenedColor(grades[i] + 1) + '"></i> ' +
grades[i];
}
return div;
};
legend.addTo(map);
} else if (choice == "Number with High Lead"){NumHighCountLayer.addTo(map)}
else {PCTHighCountLayer.addTo(map)}
}