OpenLayers – Fixing Missing LayerSwitcher in OpenLayers3

mapcontrolopenlayers

I was wondering if there is a LayerSwitcher control in OpenLayers 3?

I read that ol3 is a complete rewrite. But I can't seem to find the equivalent of LayerSwitcher from http://openlayers.org/en/latest/apidoc/ol.control.html. I don't see how one can turn on and off layers without this control. Is LayerSwitcher renamed to something else, missing or is the documentation incomplete?

If OpenLayers3 does not have LayerSwitcher, does anyone know of an example that implements a custom control like the old LayerSwitcher?

Best Answer

This question was asked on Twitter recently https://twitter.com/RemiBovard/status/525028570780139520

If you follow the answer, at the moment, integrating layer switcher in the core is not the priority but there is an available component at https://github.com/walkermatt/ol3-layerswitcher

You can also take a look on "The book of OpenLayers" samples (by @acanimal) for some custom legend implementations.