[OpenLayers-Users] svn - How to style color on WFS?
Andreas Hocevar
andreas.hocevar at gmail.com
Tue Mar 4 19:08:27 EST 2008
Hi,
Stephen Woodbridge wrote:
> I'm trying to update my feature editing demo from OL 2.5 to 2.6(svn).
>
> http://imaptools.com/~woodbri/edit/index26.php?extent=-129,19+-60,60
>
> In 2.5, I did something like this:
>
> feature.style.strokeColor = "#ff0000";
>
I see you have your wfs layer assigned to the variable "wfs". Instead of
wfs.style.strokeColor = "#00ffff";
you need to do:
wfs.styleMap = new OpenLayers.StyleMap({strokeColor: "#00ffff"});
There is no need to set a feature style for added features, so you can remove your instances of
feature.style.strokeColor = "#ff0000";
> What is the equivalent for 2.6? Is there an example that show this for
> 2.6? I looking but haven't found it yet.
>
An example for this is at http://www.openlayers.org/dev/examples/styles-unique.html
There is also a tutorial at http://trac.openlayers.org/wiki/Styles
Regards,
Andreas.
More information about the Users
mailing list