[OpenLayers-Users] Refresh an indepent Layer... every n
seconds...
Arnd Wippermann
arnd.wippermann at web.de
Fri Aug 1 12:38:30 EDT 2008
Hello,
declare map, recorridos and Counter (var Counter=0;) as global variables and
change your
function Layer_redraw() {
recorridos.mergeNewParams({ counter : counter++ });
}
That should work.
Arnd Wippermann
_____
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von David Calle
Gesendet: Freitag, 1. August 2008 17:27
An: users
Betreff: [OpenLayers-Users] Refresh an indepent Layer... every n seconds...
Hi List,
I have a map published with MapServer and OpenLayers, I need to refresh only
of them, every 10 seconds for example, to simulate a GPS.
Apparently I could usage "redraw" but does not work ... o
I hope your help .. this is part of my publication... the layer is
recorridos...
Or if there are another way tell me please...
<html>
<head>
<style type="text/css">
#map {
width: 900px;
height: 600px;
}
</style>
<title>Sistema de Trasporte Urbano - Cuenca Ecuador </title>
<script src="OpenLayers.js"></script>
<script type="text/javascript">
function init()
{
var mapOptions = {
maxExtent: new OpenLayers.Bounds(713620.5057, 9673754.1986,
732936.3635, 9687405.8116),
maxResolution: 'auto',
projection:"EPSG:32717",
units: "m"};
var map = new OpenLayers.Map('map', mapOptions);
map.addControl(new OpenLayers.Control.LayerSwitcher());
var panel = new OpenLayers.Control.NavToolbar();
map.addControl(panel);
map.addControl(new
OpenLayers.Control.MousePosition({'div':OpenLayers.Util.getElement('coords')
}));
var manzanas = new OpenLayers.Layer.MapServer.Untiled( "manzanas",
"../../cgi-bin/mapserv",
{map:'C:/data/publicacion.map',
layers: 'manzanas',map_imagetype: 'png'},
{'displayInLayerSwitcher':false});
var ruta22 = new OpenLayers.Layer.MapServer.Untiled( "Ruta 22",
"../../cgi-bin/mapserv",
{map:'C:/data/publicacion.map', transparent: "true",
layers: 'ruta22_ida',map_imagetype: 'png'},{'isBaseLayer':
false}, {'displayInLayerSwitcher':false});
var recorridos = new OpenLayers.Layer.MapServer.Untiled( "Unidad()",
"../../cgi-bin/mapserv",
{map:'C:/data/publicacion.map',
layers: 'recorrido',transparent: "true", map_imagetype: 'png'});
ruta22.setVisibility(false);
map.addLayers([ruta22, manzanas, recorridos]);
if (!map.getCenter()) map.zoomToMaxExtent();
setTimeout("Layer_redraw()",10*1000);
}
function Layer_redraw() {
var name = 'Test Layer';
var url = "../../cgi-bin/mapserv";
var params = { map: 'C:/data/publicacion.map',
layers: 'recorrido',
transparent: "true",
map_imagetype: 'png'};
var layer = new OpenLayers.Layer.WMS(name, url, params);
var map = new OpenLayers.Map('map');
map.addLayer(layer);
layer.redraw(true);
}
</script>
</head>
<body onLoad="init()">
<table>
<tr>
<td align="left"><div id="map"></div></td>
</tr>
</table>
</body>
</html>
Thanks for all...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080801/28ca79a6/attachment.html
More information about the Users
mailing list