Leaflet: How do you use removeLayer?
If you want to remove the grayscale map from the start just delete:
"Grayscale": grayscale,
From
var baseMaps = {
"Grayscale": grayscale,
"Streets": streets
};
If you want to remove the layer on a click you call it as a method on the map object. Like so:
map.removeLayer(grayscale)
To remove it from the control you first have to assign the control to a variable. Change this:
L.control.layers(baseMaps, overlayMaps).addTo(map);
To this:
lcontrol = L.control.layers(baseMaps, overlayMaps).addTo(map);
Then you can call:
lcontrol.removeLayer(grayscale)
..to remove it from the control.