-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
46 lines (41 loc) · 1.32 KB
/
index.html
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
45
46
<!doctype html>
<html>
<head>
<title>Socket.IO client</title>
<style type="text/css">
html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
</style>
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js"></script>
<script>
var socket = io.connect('http://127.0.0.1:8080');
var map;
function initialize() {
//var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
center: new google.maps.LatLng(54.444492, 46.406250),
zoom: 3,
mapTypeId: google.maps.MapTypeId.ROADMAP,
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
}
socket.on('updated', function(msg){
var lat = msg['lat'];
var lon = msg['lon'];
var marker = new google.maps.Marker({
position: new google.maps.LatLng(lat, lon),
map: map,
//title: 'Hello World!'
});
console.log(marker);
//$('#coordinates').append(JSON.stringify(msg)+'<br>');
});
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>