I'm displaying gps track data (e.g. points in time, like the path a vehicle covered) and I need to allow the user to "play back" the track, by having the markers change color one at a time in sequence. So imagine a sequence of yellow markers and then during playback I change the first one to a red marker, then the next one, etc.
I've done a prototype using point features because it seemed easier at the time to implement this with Points because I could do the following (pseudo code):
p = getpointFromLayer(); // get the yellow point from the layer
p.style = myRedStyle; // change it's style
p.layer.drawFeature(p); // redraw the feature using the red style
Now I'd like to re-do this functionality using Markers because Markers seem to generally be more flexible for other functionality, but I don't know whether it's possible to somehow change a specific marker's appearance. Any ideas?
Best Answer
I have not tried the following code, but I am reasonably sure you should be able to change a marker's icon by simply:
hide it:
enlarge the icon (might pixelize with certain formats):
Look at source (https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Marker.js) for more information.