[OpenLayers-Users] Updating Text Layer - flickering markers

Andreas Hocevar ahocevar at opengeo.org
Thu Oct 8 06:05:45 EDT 2009


rmanor wrote:
> I have a map with a single text layer.
> My text file is being updated every minute so I wrote a code that destroys
> the existing layer and creates a new one.
> The markers are updated correctly but when they do, I get this annoying
> "flickering" effect of the markers' icons. It's not so bad when the markers
> are moving but if the markers are at the same place, they just flicker on
> the spot.
>
> Anyway to make this look nicer?
>   

Don't destroy the layer before creating a new one. Create a new layer,
and destroy the old one when the new one is loaded (i.e. in a loadend
event handler of the new layer).

An even smarter way would be to not use a Markers layer, but a Vector
layer with HTTP protocol, Text format and a Fixed strategy. Then you can
just load the new text file, and there will be no flicker.

Regards,
Andreas.


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list