[OpenLayers-Users] Styling dynamically depending on attributes
Paul Holthues
einpaule at gmail.com
Tue Apr 26 08:36:29 EDT 2011
Hello all,
I'm struggling with styling features depending on some attributes
defined on the feature.
I have a two level distinction:
feature.data.featureType (Which determines type icon (a tree, little man, etc.)
feature.data.featureImportance (Which which subicon to show (a greyed
out tree, a fully colored tree, a red tree, a greyed out little man,
etc.))
The featureType does not change during runtime, the importance can
change however.
I tried to use the attributes in a stylemap for the layers as follows:
[...]
externalGraphic: "images/${featureType}/${featureImportance}.png"
[...]
but the icons do not get updated on redraw of the layers.
I can think of using stylemap and using ".addUniqueValueRules". But it
would be simpler with the above approach (if it worked). Would I have
to recreate the layers for it to work? Is there a cleaner and more
straight forward way of styling this?
Thanks in advance,
Paul
More information about the Users
mailing list