Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've created a bunch of Feature.Vectors from Point objects and assigned them a Style. Now I want to dynamically change the appearance of one of the features in real time; e.g., change it from red to blue. (I am NOT hovering over the feature.) I've tried changing its Style, then doing refresh() on the layer, or redraw(), etc, and either nothing happens or the feature disappears. Any suggestions? Thanks.

share|improve this question
    
have you save this problem already? –  user25495 Jan 6 at 14:40

2 Answers 2

I agree with @drnextgis that redraw will do (+1 for nice sample). Though in your situation, since you want to just redraw a single feature, I would use feature.layer.drawFeature(feature); which is presented in the following sample here.

share|improve this answer

Redraw method should solve your problem, see my little example: OpenLayers: modifying feature style

UPD: I've modified my example a little bit: OpenLayers: modifying one feature style

share|improve this answer
    
Thanks however this appears to change the appearance of the entire layer, rather than that of a particular one of many features in the layer, right? –  bethesdaboys Nov 17 '11 at 14:48
    
Could you look at new example, is it what you need? –  drnextgis Nov 21 '11 at 2:08
    
@drnextgis : Nice example. +1 –  simo Nov 21 '11 at 14:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.