[OpenLayers-Users] get feature attributes values on styles

Pedro Costa pedrocostaarma at sapo.pt
Tue Aug 13 03:39:32 PDT 2013


Hi guys,

I'm have one layer that i want style according attributes (id and name) 
values.
Its a layer with many features and, for all, i want a different style.
My question is if its possible get attributes values in style. Something 
like that:

                                 new OpenLayers.Rule({
                                     title: feature.attribute.name 
<-----------------here
                                     symbolizer: {
                                             graphicWidth: 30,
                                             graphicHeight: 30,
                                             graphicYOffset: -26,
                                             graphicOpacity: 1,
                                             externalGraphic: 
"../../img/simbologia_layers/pdi/" + feature.attribute.id + ".png" 
--------------here
                                             }
                                     }),

If not i have to write a rule for all my features in the layer?I can use 
a for loop but i can get the name....

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130813/3cc064ba/attachment-0001.html>


More information about the Users mailing list