Tuesday, 27 December 2016

openlayers - Missing LayerSwitcher in OpenLayers3?


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?



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...