Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 848 Bytes

README.md

File metadata and controls

31 lines (19 loc) · 848 Bytes

Layer control for OpenLayers 3.x and above

Example on how to create a layer control in OpenLayers 3.x and above. This example uses OpenLayers 4.2.0.

This example adds a layer control to the map.

Running the App

Just check the index.html for details.

A live example in :

https://htmlpreview.github.io/?https://github.com/lcalisto/ol-layer-control/blob/master/index.html

Notes

In order to make this layer control work, make sure you add basemap:boolean and name:text to your layers object.

To add the layer control

The main function to add the control is:

showLayersControl()

To remove the control

Function removeLayersControl() removes the layer control.

removeLayersControl()