webcam.html
1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<html xmlns="http://www.w3.org/1999/xhtml">
<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://crschmidt.net/~crschmidt/openlayers.jpg',
new OpenLayers.Bounds(0, 0, 640, 480),
new OpenLayers.Size(640, 480),
options);
map.addLayers([webcam]);
map.zoomToMaxExtent();
window.setInterval(refresh, 10000, 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>