[OpenLayers-Users] Style WFS layer by attributes

AlessioDL alessio.dilorenzo at gmail.com
Tue Sep 1 09:48:36 EDT 2009


Hi Jerome,  

probably I don't understood exactly how to apply your suggestion...

If I use "new OpenLayers.Style" I can't apply any style to my features.
The only way to style them appear to be:
OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default'])

So I need to do something like

//Vector layer style
var area_style = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']);

if (feature.attributes.myattribute == 'myvalue') {
     area_style.strokeWidth = 1.5;
     area_style.strokeColor = "#ff0000";
     area_style.fillOpacity = 0.75; 
} else {
...
}

but it does not work (feature is undefined)... 
-- 
View this message in context: http://n2.nabble.com/Style-WFS-layer-by-attributes-tp3559456p3560624.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list