[OpenLayers-Users] can't style a feature .... please help

JK Chen jk.chen at sdl.usu.edu
Thu Jun 30 10:48:37 EDT 2011


Okay, I got it to work. The second argument is for attributes, while the third is for the style object,
This line works:
               polygon1 = new OpenLayers.Feature.Vector(lines, {},{strokeWidth:1, 'strokeColor': 'red'});

From: Robert Sanson [mailto:Robert.Sanson at asurequality.com]
Sent: Wednesday, June 29, 2011 3:48 PM
To: openlayers-users at lists.osgeo.org; JK Chen
Subject: Re: [OpenLayers-Users] can't style a feature .... please help

Try something like:

var style1 = new OpenLayers.style({strokeWidth:5, 'strokeColor': '#ff0000'});
polygon1 = new OpenLayers.Feature.Vector(lines, style:style1);

regards,

Robert

>>> JK Chen <jk.chen at sdl.usu.edu<mailto:jk.chen at sdl.usu.edu>> 30/06/2011 9:27 a.m. >>>
Hi,
I am trying to style individual feature with OpenLayers.Feature.Vector statement, as this:

                              .
                              lines = new OpenLayers.Geometry.LineString([p1,p2, p3, p4, p1]);
                              polygon1 = new OpenLayers.Feature.Vector(lines, {strokeWidth:5, 'strokeColor': '#ff0000'});
However, it's not working for me.
Is there anything missing?
Thanks.
JK


Click here<https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==> to report this email as spam.


This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.

This message has been scanned for Malware and Viruses by Websense Hosted Security. www.websense.com<http://www.websense.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110630/2b1c2171/attachment.html


More information about the Users mailing list