I would like to set my overlayimage off when reload the map.

According to the link:


I tried sth like this:

   var overlayMaps = (null,{
    "Geographic names": positronLabels,
    "City fibre": cityfibre

but there is no reaction on my map

In turn this example:


Esri leaflet layers turned off by default in map layer control box

shows how to remove some layer instead of switch it off at the initial stage.

When I put null into my code, my overlay layers are gone:

    L.control.layers(baseMaps, null, overlayMaps).addTo(map);

I couldn't find a good solution on the Leaflet.js reference:


Is there any option to make them switched off at the initial stages?

Layers gone

Layers unchecked


This is a simply thing, that we must do.

the .addTo(map) states, that layer will be switched on as a default.

We must remove it if we want the different result:

    cityfibre = L.layerGroup([Peterboro, Coventry,]);//.addTo(map);

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.