[OpenLayers-Dev] Auto-refresh layers
Daisuke YOSHIDA
daiy115 at yahoo.co.jp
Wed Sep 5 01:44:38 EDT 2007
I would like to have auto-refresh layer function.
And I tried webcam.html which is in the examples directory under
OpenLayers-2.4.
It blinks when its function works but the layer does not be redraw.
<head>
<style type="text/css">
p {
width: 512px;
}
#map {
width: 640px;
height: 480px;
border: 1px solid gray;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map;
function init(){
map = new OpenLayers.Map('map',
{maxExtent: new OpenLayers.Bounds(0, 0, 640, 480)});
var options = {maxResolution: 'auto', numZoomLevels: 3};
var webcam = new OpenLayers.Layer.Image(
'OL Webcam',
'http://xxx.xxx.xxx.xxx/test.jpg',
new OpenLayers.Bounds(0, 0, 640, 480),
new OpenLayers.Size(640, 480),
options);
map.addLayers([webcam]);
map.zoomToMaxExtent();
window.setInterval(refresh, 1000, webcam);
}
function refresh(layer) {
layer.moveTo(layer.map.getExtent(), true);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Webcam</h1>
<div id="map"></div>
</body>
</html>
Thank you very much,
Daisuke
--------------------------------------
Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar
http://pr.mail.yahoo.co.jp/toolbar/
More information about the Dev
mailing list