-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMultipleLocLatLong.html
95 lines (77 loc) · 2.13 KB
/
MultipleLocLatLong.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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Google Maps APIs</title>
</head>
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
line-height: 1.5;
}
#map {
height: 100%;
}
a {
text-decoration: none;
}
</style>
<body>
<div id="map"></div>
<script type="text/javascript">
function initMap() {
var broadway = {
info: '<strong>Chipotle on Broadway</strong><br>\
5224 N Broadway St<br> Chicago, IL 60640<br>\
<a href="https://goo.gl/maps/jKNEDz4SyyH2">Get Directions</a>',
lat: 12.84477,
long: 80.2362
};
var belmont = {
info: '<strong>Chipotle on Belmont</strong><br>\
1025 W Belmont Ave<br> Chicago, IL 60657<br>\
<a href="https://goo.gl/maps/PHfsWTvgKa92">Get Directions</a>',
lat: 12.9010,
long: 80.2279
};
var sheridan = {
info: '<strong>Chipotle on Sheridan</strong><br>\r\
6600 N Sheridan Rd<br> Chicago, IL 60626<br>\
<a href="https://goo.gl/maps/QGUrqZPsYp92">Get Directions</a>',
lat: 12.8283,
long: 80.2188
};
var locations = [
[broadway.info, broadway.lat, broadway.long, 0],
[belmont.info, belmont.lat, belmont.long, 1],
[sheridan.info, sheridan.lat, sheridan.long, 2],
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 13,
center: new google.maps.LatLng(12.84477, 80.2279),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.m aps.InfoWindow({});
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function () {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCnahpwY4LRTYlzEHnER3B_Y8NR1HzmrVE&callback=initMap"></script>
</body>
</html>