This module provides a behavior for maps in OpenLayers.
Once enabled, it provides a new Drupal block with a list of layers and overlays that you can enable or disable, just like in the screenshot.
This module also works if you have multiple maps and layerswitcher blocks enabled on a single page.
This module works for OpenLayers version greater or equal to 7.x-2.0-beta3.
$config = array(
'map_name' => 'default',
'baselayers_element_type' => 'select' // select or radios
$form = drupal_get_form('olebs_blockswitcher_form', $config);
Combined with the Chosen module, it's great, check out the last screenshot !