-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
61 lines (50 loc) · 1.32 KB
/
index.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
<meta http-equiv="refresh" content="5" >
<h3>Bus Locations</h3>
<head>
<style type="text/css">
#map {
height: 600px;
width: 100%;
}
</style>
</head>
<div id="map" style="height: 100px;width: 200px"></div>
<script type="text/javascript">
function initMap() {
var read = new XMLHttpRequest();
read.open('GET', 'input.txt', false);
read.send();
var uluru2 = read.responseText + "";
obj = eval(uluru2)
var uluru = [];
for(var i = 0; i < obj.length; i++)
{
var posObj = eval(obj[i]);
var temp = {};
temp.lat = posObj.latitude;
temp.lng = posObj.longitude;
uluru[i] = temp;
}
var icon = {
url: "http://findicons.com/files/icons/2219/dot_pictograms/256/bus.png", // url
scaledSize: new google.maps.Size(20, 20), // scaled size
origin: new google.maps.Point(0, 0), // origin
anchor: new google.maps.Point(10, 10) // anchor
};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: uluru[0]
});
for (i = 0; i < uluru.length; i++) {
var marker1 = new google.maps.Marker({
position: uluru[i],
map: map,
icon: icon
});
console.log(uluru[i]);
}
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDv38otx-lEdLtMbTjXahCKmYBGK5xo5F8&callback=initMap">
</script>