[OpenLayers-Users] Select style for point features

Alexandre Dube adube at mapgears.com
Tue Mar 2 10:48:22 EST 2010


Olivier THIERRY wrote:

> For what I understood, when you define a "default" style, other styles
> extend this default style. So when defining a "select" style for
> example, you just have to set the style attributes that you want to be
> different from default style. And it works very well indeed. I read
> this there : http://trac.openlayers.org/wiki/Styles#UsingPropertyStyles
>   
Didn't know that.  Thanks for the input.


> Do you know if there is a way to tell OpenLayers to apply the rule
> only for some elements of the layer ? Or another workaround for this ?
>   
You could try to add a rule with an 'elseFilter': true property :

rules = [new OpenLayers.Rule({
          symbolizer: {strokeColor:"red",strokeWidth: 2},
                elseFilter: true
            })];
oYourStyleMap.styles["default"].addRules(rules);

Regards,

-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list