-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.js
35 lines (33 loc) · 1.22 KB
/
application.js
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
// TODO: Implement saved initial location
var center = new google.maps.LatLng(42.73, -73.6775);
var stops_url = "http://shuttles.rpi.edu/shuttle_tracking.kml";
var west_route_url = "http://shuttles.rpi.edu/routes/1.kml";
var east_route_url = "http://shuttles.rpi.edu/routes/2.kml";
var shuttles_url = "http://shuttles.rpi.edu/positions/current.kml";
var stops_layer = null;
var west_route = null;
var east_route = null;
var shuttles = null;
var map = null;
// Call this function when the page has been loaded
function initialize()
{
var myOptions = {
zoom: 16,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
stops_layer = new google.maps.KmlLayer(stops_url, { map: map });
west_route = new google.maps.KmlLayer(west_route_url, { map: map });
east_route = new google.maps.KmlLayer(east_route_url, { map: map });
shuttles = new google.maps.KmlLayer(shuttles_url, { map: map});
refresh_shuttles(map);
}
function refresh_shuttles(map)
{
var cache_buster = shuttles_url + "?" + UTC();
shuttles.setMap(null); // Remove shuttle layer.
shuttles = null; // Dereference.
shuttles = new google.maps.KmlLayer(cache_buster, { map: map });
}