I created a leaflet control layer to switch between two base maps (Bing and OpenCycleMap), Yet I don't see the icon inside the layer control:

var baseMaps = {
             "Bing": bingLayer,
              "OpenCycleMap": tileLayer
         };
        L.control.layers(baseMaps).addTo(map);

The result in the navigator:

enter image description here

Is there any special config to add the layer icon instead of the blank space? As I know this icon should be by default displayed.

Your help would be grateful.

The only explanation for this would be that required icon image is missing. It is either layers.png or layers-2x.png and should be in subfolder images of folder where leaflet style sheet leaflet.css is located.

You can check this with browser developer tools (F12, network section). If icon is really missing you will get 404 status for icon image file.

  • it is actually missing I checked it. I added the folder images but still the problem persists. I did use cdn but no remarkable change. – zakaria mouqcit Nov 30 at 7:36
  • Did you check in browser developer tools (F12, network section) the location from where browser tries to download the image? – TomazicM Nov 30 at 14:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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