[OpenLayers-Users] Updating Text Layer - flickering markers

Andreas Hocevar ahocevar at opengeo.org
Sun Oct 18 19:25:49 EDT 2009


Ran Manor wrote:
> Hi,
> 
> I implemented your suggestion using a GML layer but I couldn't figure 
> out how to tell the layer to reload the source text file.
> 
> How do I do that?

Don't use Layer.GML, but Layer.Vector. Configure it with a HTTP protocol 
with Text format and a Fixed Strategy. To reload, do strategy.load().

Regards,
Andreas.

> Thanks.
> 
> - Ran
> 
> 
> On Thu, Oct 8, 2009 at 12:05, Andreas Hocevar <ahocevar at opengeo.org 
> <mailto:ahocevar at opengeo.org>> wrote:
> 
>     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.
> 
> 


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



More information about the Users mailing list