Hi,

XYZ layers usually use cached tilesets where the server cache controls browser 
caching by using etags and/or appropriate cache header. So it should not be 
necessary to use a random param to invalidate the browser cache.

It seems you have access to the server or do something in your application that 
changes tiles on the server, and this is why you want a redraw on the client. 
If so, it should also be possible for you to use etags. If not, I'd suggest 
dealing with this on the application level, e.g. by changing the layer's url 
before the redraw.

Andreas.

On Nov 4, 2011, at 17:58 , JD wrote:

> Hi,
> I try to force redraw of a XYZ layer on timeout using the redraw(true)
> method on layer.
> 
> But it doesn't seems to do the trick, no random argument is added to
> HTTP GET tiles requests.
> 
> After some time looking code I modified XYZ class.
> http://trac.osgeo.org/openlayers/browser/trunk/openlayers/lib/OpenLayers/Layer/XYZ.js
> 
>> From :
> 129       getURL: function (bounds) {
> 130           var xyz = this.getXYZ(bounds);
> 131           var url = this.url;
> 132           if (OpenLayers.Util.isArray(url)) {
> 133               var s = '' + xyz.x + xyz.y + xyz.z;
> 134               url = this.selectUrl(s, url);
> 135           }
> 136   
> 137           return OpenLayers.String.format(url, xyz);
> 138       },
> 
> To :
> 129       getURL: function (bounds) {
> 130           var xyz = this.getXYZ(bounds);
> 131           var url = this.getFullRequestString();
> 132           if (OpenLayers.Util.isArray(url)) {
> 133               var s = '' + xyz.x + xyz.y + xyz.z;
> 134               url = this.selectUrl(s, url);
> 135           }
> 136   
> 137           return OpenLayers.String.format(url, xyz);
> 138       },
> 
> It seems that random parameter added to class this.params are only
> used by HTTPRequest::getFullRequestString and ignored by XYZ::getURL.
> After some tests this modification seems to work fine.
> 
> Can you tell me if this is a genuine bug or I simply use the
> OpenLayers API incorrectly ?
> 
> Thanks,
> JD.
> _______________________________________________
> Dev mailing list
> d...@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev



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

_______________________________________________
Dev mailing list
d...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev

Reply via email to