[OpenLayers-Users] redraw or refresh a text layer?

Obe, Regina robe.dnd at cityofboston.gov
Thu May 29 07:44:17 EDT 2008


Eric,

Actually I had suggested the below to Carl offlist.  The reason I
suggested tacking the random to his location is that say you have a 
.txt file that gets automatically generated every so often.  A lot of
web servers like IIS treat these kind of files as static and will send a
directive to the web browser to cache them and then browsers.  They will
not give a new version unless you fool them into thinking its a
different file you are asking for by tagging a random seed on it. Also
browsers have varying hockeyness on how they decide when to get a fresh
copy or read from cache.

True you could change the behavior if you had control of  the web server
(which if you are on a shared box you don't necessarily). You would also
take a performance hit on things that really should be cached.

Just my two cents.

Regina 

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Eric Lemoine
Sent: Wednesday, May 28, 2008 3:55 PM
To: Carl Morgan
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] redraw or refresh a text layer?

On Tue, May 27, 2008 at 4:14 PM, Carl Morgan <carl.r.morgan at noaa.gov>
wrote:
> Regina,
>
> I got the following function to redraw the layer. Not sure I
understand
> why this works, but it does. I call it immediately after I call my
init
> function. I appreciate your help!
>
> -Carl
>
>        function refresh_markers() {
>
>            reports.redraw(true);
>            map.removeLayer(reports);
>            reports.destroy();
>            reports = new OpenLayers.Layer.Text( "New Rep", {location:
> "./" + textfile + "?" + Math.random()});
>            map.addLayer(reports);
>        }

Are you saying that it doesn't work without the random() call?

If the web server serving the text file is yours you should probably
configure it to prevent browsers from caching that text file. To me
this isn't a problem on the OpenLayers side.

--
Eric
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the Users mailing list