[OpenLayers-Users] How to access style properties of features?

Peter.Sykora at ooe.gv.at Peter.Sykora at ooe.gv.at
Mon Dec 21 09:59:44 EST 2009


Hi,

>It is calculated from the styleMap when drawing the layer. You 
>can access these properties like this. Let's say "layer" is 
>your layer, and "feature" a feature you are interested in:
>
>var symbolizer = layer.styleMap.createSymbolizer(feature,
>feature.renderIntent);
>
>Now if you want to know your graphicWidth, you can access
>
>symbolizer.graphicWidth

Yes, it works fine when I use the code released eg. by an onclick event.
When I use it within one of my style functions, I then get a "too many
recursions" error.
Anyhow, thanks to your earlier post I found a workaround that works fine
for me. Whenever I set a new style property that I need for further
calculations, I store the value in a feature attribute. This way I can
access the value later on without a need for a direct access to a style
or whatever property.

Thanks a lot for your hints!
Peter



More information about the Users mailing list