-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
82 lines (66 loc) · 1.7 KB
/
script.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
function initMap() {
const EastLansing = {lat: 42.723132, lng: -84.477875};
const map = new google.maps.Map(document.getElementById("map"), {
center: EastLansing,
zoom: 14,
});
/*
const marker = new google.maps.Marker({
position: EastLansing,
map: map,
});
const infoWindow = new google.maps.InfoWindow({
content: '<h1>3 Cameras</h1>'
});
marker.addListener('click', function(){
infoWindow.open(map,marker);
});
*/
var markers = [
{
coords:{lat: 42.725781, lng: -84.482348},
iconImage:'',
content:'<h1>1 Cameras at the intersection of North Shaw Lane & Red Cedar Road</h1>'
},
{
coords:{lat: 42.729256, lng: -84.477821},
content:'<h1>4 Cameras at the intersection of Farm Lane & Auditorium Road</h1>'
},
{
coords:{lat: 42.725216, lng: -84.462583},
content:'<h1>2 Cameras at the intersection of East Shaw Lane & South Hagadorm Road</h1>'
}
];
/*
addMarker(
{coords:{lat: 42.723132, lng: -84.477875},
iconImage:'',
content:'<h1>2 Cameras</h1>'
});
addMarker(
{coords:{lat: 42.729256, lng: -84.477821},
content:'<h1>4 Cameras at the intersection of Farm Lane & Auditorium Road</h1>'
});
*/
for(var i = 0; i < markers.length;i++){
addMarker(markers[i]);
}
function addMarker(props){
const marker = new google.maps.Marker({
position: props.coords,
map: map,
//icon:props.iconImage
});
if(props.iconImage){
marker.setIcon(props.iconImage);
}
if(props.content){
const infoWindow = new google.maps.InfoWindow({
content: props.content
});
marker.addListener('click', function(){
infoWindow.open(map,marker);
});
}
}
}