Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
82 lines (76 sloc) 2.37 KB
<!doctype html>
<html>
<head>
<title>Sensor Data</title>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js">
</script>
<style type="text/css">
html {
height: 100%
}
body {
height: 100%;
margin: 0;
padding: 0
}
#map_canvas {
height: 100%;
width: 100%;
background-color: silver;
}
</style>
</head>
<body>
<div id="map_canvas" style="width:100%; height:100%"></div>
<script type="text/javascript">
var locations = {};
var map;
function initialize() {
var mapOptions = {
center:new google.maps.LatLng(35.773371, -78.67743),
zoom:8,
mapTypeId:google.maps.MapTypeId.TERRAIN
};
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
}
function updateMap() {
$.ajax(
{
url:'provider/data',
success:function (data) {
var tsData = eval(data);
for (id in tsData) {
var myLatLng = new google.maps.LatLng(
tsData[id]['latitude'],
tsData[id]['longitude']);
if (locations[id] != null) {
locations[id].setMap(null);
locations[id] = null;
}
var marker = new google.maps.Marker({
position:myLatLng,
title:id
});
marker.setMap(map);
marker.setIcon("./marker?stroke=" +
tsData[id]['level'] +
"&maxLevel=" +
tsData[id]['maxLevel']);
locations[id] = marker;
}
}
}
);
}
initialize();
setInterval(function () {
updateMap()
}, 1000);
</script>
</body>
</html>