[OpenLayers-Users] Style WFS layer by attributes

AlessioDL alessio.dilorenzo at gmail.com
Tue Sep 1 05:50:05 EDT 2009


Hi, 

I have this WFS layer from my UMN-Mapserver

//Vector layer style
var area_style = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']);
     area_style.strokeWidth = 1.5;
    area_style.strokeColor = "#ff0000";
    area_style.fillOpacity = 0.75;


//Layer definition 
qAreas = new OpenLayers.Layer.Vector("WFS",
    		{
    	        strategies: [new OpenLayers.Strategy.BBOX()],
    	        filter: propertyFilter, 
    	        style:area_style,
    	        protocol: new OpenLayers.Protocol.WFS({
    		        url:  wfsURL, 
    		        extractAttributes:true,
    		        featureType: "QueryAreas",
    		        geometryName:"the_geom"
    	        })
});


I'd like to use an attribute value to style things differently 
(for example, if the value of the attribute named type is "A" the
corresponding polygons bacame red and if it is "B" they became blue)

Can you help me? :-)

-- 
View this message in context: http://n2.nabble.com/Style-WFS-layer-by-attributes-tp3559456p3559456.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list