It is possible to change markers or styles based on data in your website. For example, a user can set the color of a marker, choosing a color when adding a new âDrupal User Groupâ to your website. This data-driven styling is achieved with Marker Handling in the GMap module, and with Attribute Replacement in OpenLayers. Both of these techniques are powered by the Views module, which includes the data needed for styling when doing the database query that creates the data layer for the map.
GMap Marker Handling
The GMap module uses Views to display Drupal data, as described earlier in Mapping with the GMap Module. The GMap Location module allows you to choose which markers to use based on Taxonomy Terms, Content Types, and User Roles. It is also possible to create a Field in your Content Type that contains a list of marker names. To select a marker for a particular content type, edit the content type and select a marker from the list. To use this setting when creating a map, you need to specify that in the âMarker handlingâ section of the View, as shown in FigureÂ 6-6.
FigureÂ 6-6.Â Marker handling for GMap Views formatter
OpenLayers Attribute Replacement
In the OpenLayers module, it is possible to replace any Style value with data, specifically Views data. To achieve this in the OpenLayers modules, we first have to tell Views that we want to use new some fields, ...