-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcharger_map.html
121 lines (103 loc) · 3.4 KB
/
charger_map.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
<head>
<title>Optimal New Charger Locations in Windsor</title>
<script type="text/javascript" src="hwy_cords.json"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js%22%3E></script> -->
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<!-- jsFiddle will insert css and js -->
</head>
<body>
<div id="map"></div>
<!-- Async script executes immediately and must be after any DOM elements used in callback. -->
<script
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCFwOrG7_5TDJ1--cYZ2YiMZyxILDOYe34&callback=initMap&v=weekly&channel=2"
async
></script>
<script>
var lat = [42.1535396, 42.0197824, 42.3050999, 42.2996581, 42.2932886, 42.2445224, 42.2759124, 42.2415392, 42.240454, 42.2562413]
var lon = [-82.8105986, -82.7608013, -82.556022, -82.7812037, -82.717007, -83.0234915, -83.0063809, -82.5481834, -82.9878112, -83.037992]
function initMap() {
// Automate this process using the output of Ahsan's code
const myLatLng = { lat: lat[0], lng: lon[0]};
const myLatLng2 = { lat: lat[1], lng: lon[1]};
const myLatLng3 = { lat: lat[2], lng: lon[2]};
const myLatLng4 = { lat: lat[3], lng: lon[3]};
const myLatLng5 = { lat: lat[4], lng: lon[4]};
const myLatLng6 = { lat: lat[5], lng: lon[5]};
const myLatLng7 = { lat: lat[6], lng: lon[6]};
const myLatLng8 = { lat: lat[7], lng: lon[7]};
const myLatLng9 = { lat: lat[8], lng: lon[8]};
const myLatLng10 = { lat: lat[9], lng: lon[9]};
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 10,
center: myLatLng3,
});
new google.maps.Marker({
position: myLatLng,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng2,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng3,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng4,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng5,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng6,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng7,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng8,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng9,
map,
title: "Hello World!",
});
new google.maps.Marker({
position: myLatLng10,
map,
title: "Hello World!",
});
}
</script>
</body>
</html>