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.

The form included in the block is not generated in Javascript just like in OpenLayers Plus, it's generated by the Drupal's form API, and so, you can alter it easily.

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 !

Project information