The fundamentals of how maps are handled in the OpenLayers module is based on a map array in PHP, that gets pass through hooks and rendered on the server side, then passed to Javascript to be turned into an OpenLayers map on the client side.

Preset UI

The Preset UI module creates a interface for the user to create maps without having to write PHP arrays. It is important to know that not all features of the map array can be controlled in the preset interface.

Map Array Parts

Example

The following example is the default preset provided by the OpenLayers module.

  $default_map = array(
    'projection' => '4326',
    'width' => 'auto',
    'default_layer' => 'openlayers_default_wms',
    'height' => '300px',
    'center' => array(
      'lat' => '0',
      'lon' => '0',
      'zoom' => '2',
    ),
    'options' => array(
      'displayProjection' => '4326',
    ),
    'controls' => array(
      'LayerSwitcher' => TRUE,
      'Navigation' => TRUE,
      'PanZoomBar' => TRUE,
      'MousePosition' => TRUE,
    ),
  );