-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
172 lines (154 loc) · 5.66 KB
/
index.html
File metadata and controls
172 lines (154 loc) · 5.66 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Marker Clustering</title>
<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>
</head>
<body>
<div id="map"></div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script>
var directionsService, directionsDisplay;
function initMap() {
var directionsService = new google.maps.DirectionsService;
var directionsDisplay = new google.maps.DirectionsRenderer;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 7,
center: {
lat: 12.9586584,
lng: 77.5684325
},
mapTypeId: 'satellite'
});
// Create an array of alphabetical characters used to label the markers.
var labels = 'S123456';
// Add some markers to the map.
// Note: The code uses the JavaScript Array.prototype.map() method to
// create an array of markers based on a given "locations" array.
// The map() method here has nothing to do with the Google Maps API.
var markers = locations.map(function(location, i) {
return new google.maps.Marker({
position: location,
label: labels[i % labels.length]
});
});
// Add a marker clusterer to manage the markers.
var markerCluster = new MarkerClusterer(map, markers, {
imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'
});
directionsDisplay.setMap(map);
console.log(locations);
var start, end;
$.getJSON("http://api.thingspeak.com/channels/265517/feed/last.json", function(data) {
var points = data['field8'];
console.log(points);
});
var tour = [{
location: new google.maps.LatLng(13.0297295, 77.6130547),
stopover: false
},
{
location: new google.maps.LatLng(13.0301762, 77.5730547),
stopover: false
},
{
location: new google.maps.LatLng(13.0090519, 77.567745),
stopover: false
},
{
location: new google.maps.LatLng(12.9800425, 77.6136859),
stopover: false
},
{
location: new google.maps.LatLng(12.9803999, 77.5363397),
stopover: false
},
{
location: new google.maps.LatLng(12.944779, 77.5933347),
stopover: false
},
];
function caller() {
var waypoints = [{
location: new google.maps.LatLng(13.115770, 77.636642),
stopover: false
},
{
location: new google.maps.LatLng(13.113731, 77.634762),
stopover: false
},
{
location: new google.maps.LatLng(13.116319, 77.634947),
stopover: false
}
];
calculateAndDisplayRoute(directionsService, directionsDisplay, waypoints);
}
caller();
function calculateAndDisplayRoute(directionsService, directionsDisplay, way) {
directionsService.route({
origin: locations[0],
destination: locations[5],
waypoints: way,
travelMode: 'DRIVING'
}, function(response, status) {
console.log(response + status);
if (status === 'OK') {
directionsDisplay.setDirections(response);
} else {
window.alert('Directions request failed due to ' + status);
}
});
}
}
var locations = [{ //Source
lat: 13.114448,
lng: 77.634688
},
{ // 1
lat: 13.114558,
lng: 77.636095
},
{ // 2
lat: 13.115770,
lng: 77.636642
},
{ // 3
lat: 13.117358,
lng: 77.634496
},
{ // 4
lat: 13.112750,
lng: 77.634206
},
{ // 5
lat: 13.116319,
lng: 77.634947
},
{ // 6
lat: 13.113731,
lng: 77.634762
}
];
</script>
<script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js">
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBD8mKo07QrqmTBsPE0A-7D3gKth7pJWMw&callback=initMap">
</script>
</body>
</html>