On Custom Markers page is a description on how to create dynamic styles using OpenLayers Styles and variables from View. There is also other approach, using style field in OpenLayers Data Overlay options. This one seems to be much more simple and limited.

There should be some info, which will help to guide decisions abou which approach to use.

Also, I'm not sure if Custom Markers is a correct name for the page, "Dynamic styles" seems more appropriate to me, since we can change not only externalGraphic, but also other properties.


milos.kroulik’s picture

Issue summary:View changes
Status:Active» Closed (won't fix)

I guess I should close this issue because of this commit.

Pol’s picture


I hope you like the changes! It's a major improvement!

jlsevillano’s picture

I'm trying to select the style from the value of the other field, for example,my content type has one field: Production (low,medium,high) and i want to select a different fillcolor (openlayers style) depending the field production value.
I know that in openlayers 7.2x i have (format: OL vector data overlay - options) one field that i can select the style, but not runs ok. My markers has not png image, only fillcolor.

Some way to resolve it?


milos.kroulik’s picture

Yes, I needed to solve the same problem. There are two way to approach this problem:

  1. If "Production" is vocabulary, you can add simple field to it (named e.g. "fillcolor") and add this field in Data Overlay View. It's then available for styling
  2. You can also use custom PHP field in Views to calculate the correct value dynamically. The rest of the proccess is same.

Also, this issue is closed. Next time, please open separate support request for your question.