[OpenLayers-Dev] redraw(true) and random HTTP GET parameter with XYZ Layer

JD jdbrossillon at fly-n-sense.com
Fri Nov 4 12:58:31 EDT 2011


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.


More information about the Dev mailing list