forked from Ru-Hacks/Coronacast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
googleMaps.js
62 lines (52 loc) · 1.91 KB
/
googleMaps.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//import {map1, marker1} from './weather.js';
// var map;
var map;
var marker;
function initMap() {
var place = {lat: 43.6532, lng: -79.3832};
var options = {
zoom: 14,
center: place
};
map = new google.maps.Map(document.getElementById('map'), options);
marker = new google.maps.Marker({position: place, map: map});
trafficlayer = new google.maps.TrafficLayer(); // Shows traffic (red places)
trafficlayer.setMap(map);
}
// function changeMap(map1, marker1){
// map = map1;
// marker = marker1;
// }
var trafficLayer;
var bicyclelayer;
var transitLayer;
//added by krish:
function switchTraffic(clicked_id){
trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
document.getElementById(clicked_id).style.background = "#EFEFEF";
document.getElementById(clicked_id).style.color = "#73AD21";
}
function switchBicycle(clicked_id){
bicyclelayer = new google.maps.BicyclingLayer();
bicyclelayer.setMap(map);
document.getElementById(clicked_id).style.background = "#EFEFEF";
document.getElementById(clicked_id).style.color = "#73AD21";
}
function switchTransit(clicked_id){
transitLayer = new google.maps.TransitLayer();
transitLayer.setMap(map);
document.getElementById(clicked_id).style.background = "#EFEFEF";
document.getElementById(clicked_id).style.color = "#73AD21";
}
function switchClear(){
trafficLayer.setMap(null);
bicyclelayer.setMap(null);
transitLayer.setMap(null);
document.getElementById("trafficChoice").style.color = "#EFEFEF";
document.getElementById("trafficChoice").style.background = "#73AD21";
document.getElementById("bicycleChoice").style.color = "#EFEFEF";
document.getElementById("bicycleChoice").style.background = "#73AD21";
document.getElementById("transitChoice").style.color = "#EFEFEF";
document.getElementById("transitChoice").style.background = "#73AD21";
}