[GIS] How to change overlays checkbox feature in layerlist to radio button

openlayers-2

How to change the default check box button of Overlays in Layerlist to radio buttons. My client doesn't want his users to see more than one layer on the map.

Is there any way that we can prevent the possibility to check multiple layers in overlay layers in the LayerList?

Best Answer

have you tried adding this option to your layers?

displayInLayerSwitcher: false

Here is my second answer. I have not tested it but I believe it will work.

In \Control\LayerSwitcher.js change the line, line 331 in what I am looking at, from:

    inputElem.type = (baseLayer) ? "radio" : "checkbox";

to:

    inputElem.type = (baseLayer) ? "checkbox" : "radio";

to see the change you will need to load the uncompressed OL code.