[OpenLayers-Users] Setting the color of a single vector

Jani Patokallio jpatokal at iki.fi
Tue Aug 5 05:04:43 EDT 2008


Greetings,

A very simple question, probably with a very simple answer, but I'm 
having a devil of a time figuring it out...

I have a PointTrack layer with a StyleMap attached to it.  The StyleMap 
says strokeColor: yellow, so when I draw vectors on the layer, they're 
yellow.  My question is, how do I specify that one (1) vector should 
*not* be yellow, but red?

Feature.Vector has style objects as an optional argument, but I have no 
idea what "style {Object} An optional style object" is supposed to mean, 
and my guess at "new Vector(point, {foo: "bar"}, {strokeColor: "red"})" 
does nothing.  Google searches dig up people extending the default style 
and then defining a second, entirely separate layer, while 
http://trac.openlayers.org/wiki/Styles goes straight off the deep end 
into "advanced rule-based styling", but all I want to do is draw one red 
line.  Help?

Cheers,
-jani




More information about the Users mailing list