[OpenLayers-Users] [OpenLayers-Dev] Possible to change draw color for some features?

Tim Schaub tschaub at openplans.org
Wed Feb 20 16:31:10 EST 2008


Hey-

Ed Fialkowski wrote:
> Hi,
> 
> I have an openlayers map displaying a WFS for all the counties in the US. 
> Each county (feature) has a few different attributes (SO2, CO, etc.).
> 
> I would really like, if possible, to allow the user to color the 
> features that have a certain attribute above a certain amount.
> 

The "old style" feature styles (in 2.5 and earlier) are really 
symbolizers.  If you get a copy of the trunk (or wait for 2.6), you'll 
be able to use "new style" styles.

You want to create rules (that say things like SO2 > 1.0) and group 
those together in a style.

The georss-flickr example has some code that will be useful:
http://openlayers.org/dev/examples/georss-flickr.html

The styles wiki page also has some documentation:
http://trac.openlayers.org/wiki/Styles

Before 2.6 we should get some more docs and examples out on this.

Tim


> For example, user selects SO2 and filters for values greater than 1.0.
> After hitting the 'go' button, all the features with these attributes 
> greater than 1.0 change color.
> 
> I have found some code for changing feature styles, but I think this is 
> for features drawn specifically by the user (or hardcoded, added one at 
> a time, etc., and not so much for an entire WFS full of features).
> 
> If anyone has an ideas, I would be extremely grateful.
> Thanks!
> -Ed
> !DSPAM:4033,47bc8f5c319807082231907!
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> 
> !DSPAM:4033,47bc8f5c319807082231907!




More information about the Users mailing list