Attribute Replacement
The OpenLayers library allows you to use a specific syntax,${variable_name}
, to easily style a feature based on its attributes. The most direct use of this is with the OpenLayers Views Display plugin.- Setup your Views Display according to Getting Started with OpenLayers.
- Add fields to your view that you want to use for styling (the 'attributes'). These attributes may be used as radius or color, or even icon URL later on.
- The values of these attributes are included in the OpenLayers Data view based Overlay layer that you can add to any preset.
- You need to reference each attribute by its machine-readable ID. Lookup the ID trough the
Theme:Information
link in the basic settings of your view. They have names likefield_myfield_value
. - In the style associated with your preset, you can apply your attribute as a style like this:
- pointRadius:
${field_radius_value}
- fillColor:
${field_color_value}
- pointRadius:
- Finally, create your map with your Views layer and assign it your new style; then when your map is rendered, OpenLayers will replace these values per feature.
For more information about Drupal Development, Drupal Expert, Drupal Developer and Drupal Programmer visit at http://www.dckap.com
Source: http://drupal.org/node/754480
No comments:
Post a Comment