Layers are handled in one of two ways.
Manual Layers
The first way is manually creating the layer and all the options in the full map array. Here is an example:
'layers' => array(
'default_wms' => array(
'id' => 'default_wms',
'type'=> 'WMS',
'name' => t('Default Open Layers WMS'),
'url' => 'http://labs.metacarta.com/wms/vmap0',
'params' => array(
'layers' => 'basic',
),
'options' => array(),
),
),
Named Layer
The second way is to use the a named layer provided by the hook_openlayers_layers_info() (see the OpenLayers hooks). For example:
'layers' => array(
'openlayers_default_wms',
),
Basic Layer Properties
Layer properties are unique to the type of layer. Below are the common properties.
- id
- Values:
- string
- Description:
- The identifier for the layer. This should be unique.
- Example:
- 'default_wms'
- type
- Values:
- string
- Description:
- The type of layer this is. Layer types are provided by the hook_openlayers_layer_handler_info() hook. By default, the OpenLayers module comes with a WMS and Vector types.
- Example:
- 'WMS'
- name
- Values:
- string
- Description:
- The name of the layer. This will show up in the Layer Switcher or in the preset interface if this is a named layer.
- Example:
- t('A WMS Layer')
- description
- Values:
- string
- Description:
- This is a more complete description of the layer is really only used in the preset interface.
- Example:
- t('Full description of the layer')
- projection
- Values:
- array
- Description:
- Array of strings to let the map know what kind of projections this layer supports. This is mostly used in the preset interface.
- Example:
- array('4326', '900913', '4269'),
- baselayer
- Values:
- boolean
- Description:
- Whether this layer can be used as a baselayer or not. Mostly used in the preset interface.
- Example:
- TRUE
TODO: Add docs for the specific options for each layer that OL modules provide.