[OpenLayers-Users] Need advice regarding styling vector points

Zer zer_matt at hotmail.com
Sat Mar 7 16:51:25 EST 2009




Arnd Wippermann wrote:
> 
> Hi 
> 
> you can use rules with OpenLayers.Filter.Comparison.BETWEEN
> 
> var aStyleMap = new OpenLayers.StyleMap();
> 
> var rules = [];
> rules.push(new OpenLayers.Rule({
>     symbolizer: {fillOpacity:0,
> pointRadius:3,strokeWidth:2,strokeColor:"aquamarine"},
>     filter: new OpenLayers.Filter.Comparison({
>         type: OpenLayers.Filter.Comparison.BETWEEN,
>         lowerBoundary : 1,
>         upperBoundary : 3,
>         property: "popclass"
>     })
> }));
> rules.push(new OpenLayers.Rule({
>     symbolizer: {fillOpacity:1,
> fillColor:"FFAAAA",pointRadius:5,strokeWidth:2,strokeColor:"red"},
>     filter: new OpenLayers.Filter.Comparison({
>         type: OpenLayers.Filter.Comparison.BETWEEN,
>         lowerBoundary : 10,
>         upperBoundary : 11,
>         property: "popclass"
>     })
> }));
> rules.push(new OpenLayers.Rule({
>     symbolizer: {fillOpacity:0,
> pointRadius:5,strokeWidth:2,strokeColor:"FF8000"},
>     elseFilter: true
> }));
> 
> aStyleMap.styles["default"].addRules(rules);
> vectorLayer.styleMap = aStyleMap;
> vectorLayer.redraw();
>  
> Arnd Wippermannn
> 
> 

Thanks Arnd! That's a good start to show all features. But how do I do when
the users selects (using radio buttons) to only show features in one of
those groups, i.e. with "popclass" 1-3? Do I create 3 different stylemaps if
I have a 3 radiobuttons? Or is there a better way to do it?

-Z
-- 
View this message in context: http://n2.nabble.com/Need-advice-regarding-styling-vector-points-tp2441146p2442145.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list