[OpenLayers-Users] Re: Real-time image in Openlayer

ar_gaeta riccardog79 at gmail.com
Mon Sep 5 10:56:13 EDT 2011


Thanks to all for your suggests!
I've tried out the "time" method and it works great!
For the moment I've tried to trim the url of the image, and add the new time
"dt". Next I would like to test the "MergeParams" option. I attach my code
at the end just for who could need.

Thanks again,
Riccardo


//Inside the "Ext.onReady(function() {"
setInterval('map_redraw()', 120000);


//Outside the "Ext.onReady(function() {"
function map_redraw() {
	var map_refresh = mapPanel.map;	
	var d = new Date();
	var dt = d.getTime();
		
	for (var i = 0; i < mapPanel.map.layers.length; i++) {
		var layer_to_remove = map_refresh.layers[i];

		if (!layer_to_remove.isBaseLayer &&
layer_to_remove.name.indexOf('Pioggia') !== -1) {			
			var url_image = layer_to_remove.getURL();
			var length_url = url_image.length;
			var trim_url = length_url - 13;

			layer_to_remove.setUrl(url_image.substring(0,trim_url)+dt);
			layer_to_remove.redraw(true);				
		} //end of IF
		
	} //end of cycle FOR

} //end of function "map_redraw"

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Real-time-image-in-Openlayer-tp6753728p6761011.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list