-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathchevrolet-family-road-trip-west.html
255 lines (189 loc) · 11.7 KB
/
chevrolet-family-road-trip-west.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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="description" content="The West Coast Family Road Trip by Chevrolet.">
<meta name="author" content="Chevrolet">
<title>The West Coast Family Road Trip by Chevrolet</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
#panel {
position: absolute;
top: 5px;
left: 50%;
margin-left: -180px;
z-index: 5;
background-color: #fff;
padding: 10px;
border: 1px solid #999;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script>
var routes_list = [];
var marker1, marker2, marker3, marker4, marker5, marker6, marker7, marker8, marker9, marker10, marker11, marker12;
var infoWindows = [];
var markerOptions = {icon: "http://maps.gstatic.com/mapfiles/markers2/marker.png"};
var routeMarkerOptions = {visible: false, zIndex: 0};
var directionsDisplayOptions = {preserveViewport: true,
markerOptions: routeMarkerOptions};
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
var center = new google.maps.LatLng(41.5, -123);
var mapOptions = {
zoom: 6,
center: center
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
for (i=0; i<routes_list.length; i++) {
routes_list[i].setMap(map);
}
marker1.setMap(map); marker2.setMap(map); marker3.setMap(map); marker4.setMap(map); marker5.setMap(map); marker6.setMap(map); marker7.setMap(map); marker8.setMap(map); marker9.setMap(map); marker10.setMap(map); marker11.setMap(map); marker12.setMap(map);
}
function calcRoute(start, end, routes) {
var directionsDisplay = new google.maps.DirectionsRenderer(directionsDisplayOptions);
var waypts = [];
for (var i = 0; i < routes.length; i++) {
waypts.push({
location:routes[i],
stopover:true});
}
var request = {
origin: start,
destination: end,
waypoints: waypts,
optimizeWaypoints: false,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
routes_list.push(directionsDisplay);
}
function createRoutes(route) {
// Google's free map API is limited to 10 waypoints so need to break into batches
route.push(route[0]);
var subset = 0;
while (subset < route.length) {
var waypointSubset = route.slice(subset, subset + 10);
var startPoint = waypointSubset[0];
var midPoints = waypointSubset.slice(1, waypointSubset.length - 1);
var endPoint = waypointSubset[waypointSubset.length - 1];
calcRoute(startPoint, endPoint, midPoints);
subset += 9;
}
}
optimal_route = ['400 Beach St, Santa Cruz, CA 95060', '886 Cannery Row, Monterey, CA 93940', 'Oceano Dunes State Vehicular Recreation Area, Oceano, CA 93445', '200 Santa Monica Pier A, Santa Monica, CA 90401', '1549 El Prado, San Diego, CA 92101', '855 U.S. 101, Reedsport, OR 97467', '4175 US-101, Tillamook, OR 97141', '2864 S. Pacific St., Cannon Beach, OR 97110', '3002 Mt Angeles Rd, Port Angeles, WA 98362', 'Seattle Aquarium, Alaskan Way, Seattle, WA', '85 Pike Street, Seattle, WA 98101', 'Golden Gate Bridge, San Francisco, CA 94129']
createRoutes(optimal_route);
google.maps.event.addDomListener(window, 'load', initialize);
var infoWindow1 = new google.maps.InfoWindow({ content: "<h3>Santa Cruz Beach Board Walk<br />400 Beach St, Santa Cruz, CA 95060</h3>"});
infoWindows.push(infoWindow1);
marker1 = new google.maps.Marker({
position: new google.maps.LatLng(36.9642107, -122.0185246),
options: markerOptions,
title: "Santa Cruz Beach Board Walk"
});
google.maps.event.addListener(marker1, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow1.open(map, marker1); });
var infoWindow2 = new google.maps.InfoWindow({ content: "<h3>Monterey Bay Aquarium<br />886 Cannery Row, Monterey, CA 93940</h3>"});
infoWindows.push(infoWindow2);
marker2 = new google.maps.Marker({
position: new google.maps.LatLng(36.617578, -121.901173),
options: markerOptions,
title: "Monterey Bay Aquarium"
});
google.maps.event.addListener(marker2, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow2.open(map, marker2); });
var infoWindow3 = new google.maps.InfoWindow({ content: "<h3>Pismo Sand Dunes<br />Oceano Dunes State Vehicular Recreation Area, Oceano, CA 93445</h3>"});
infoWindows.push(infoWindow3);
marker3 = new google.maps.Marker({
position: new google.maps.LatLng(35.1102862, -120.6326629),
options: markerOptions,
title: "Pismo Sand Dunes"
});
google.maps.event.addListener(marker3, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow3.open(map, marker3); });
var infoWindow4 = new google.maps.InfoWindow({ content: "<h3>Santa Monica Pier<br />200 Santa Monica Pier A, Santa Monica, CA 90401</h3>"});
infoWindows.push(infoWindow4);
marker4 = new google.maps.Marker({
position: new google.maps.LatLng(34.0100878, -118.4961372),
options: markerOptions,
title: "Santa Monica Pier"
});
google.maps.event.addListener(marker4, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow4.open(map, marker4); });
var infoWindow5 = new google.maps.InfoWindow({ content: "<h3>Balboa Park<br />1549 El Prado, San Diego, CA 92101</h3>"});
infoWindows.push(infoWindow5);
marker5 = new google.maps.Marker({
position: new google.maps.LatLng(32.7324985, -117.1492236),
options: markerOptions,
title: "Balboa Park"
});
google.maps.event.addListener(marker5, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow5.open(map, marker5); });
var infoWindow6 = new google.maps.InfoWindow({ content: "<h3>Oregon Dunes National Recreation Area<br />855 U.S. 101, Reedsport, OR 97467</h3>"});
infoWindows.push(infoWindow6);
marker6 = new google.maps.Marker({
position: new google.maps.LatLng(43.706537, -124.1027681),
options: markerOptions,
title: "Oregon Dunes National Recreation Area"
});
google.maps.event.addListener(marker6, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow6.open(map, marker6); });
var infoWindow7 = new google.maps.InfoWindow({ content: "<h3>Tillamook Cheese Factory<br />4175 US-101, Tillamook, OR 97141</h3>"});
infoWindows.push(infoWindow7);
marker7 = new google.maps.Marker({
position: new google.maps.LatLng(45.4850325, -123.8448034),
options: markerOptions,
title: "Tillamook Cheese Factory"
});
google.maps.event.addListener(marker7, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow7.open(map, marker7); });
var infoWindow8 = new google.maps.InfoWindow({ content: "<h3>Cannon Beach, Haystack Rock<br />2864 S. Pacific St., Cannon Beach, OR 97110</h3>"});
infoWindows.push(infoWindow8);
marker8 = new google.maps.Marker({
position: new google.maps.LatLng(45.8821096, -123.962944),
options: markerOptions,
title: "Cannon Beach, Haystack Rock"
});
google.maps.event.addListener(marker8, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow8.open(map, marker8); });
var infoWindow9 = new google.maps.InfoWindow({ content: "<h3>Olympic National Park<br />3002 Mt Angeles Rd, Port Angeles, WA 98362</h3>"});
infoWindows.push(infoWindow9);
marker9 = new google.maps.Marker({
position: new google.maps.LatLng(47.9691847, -123.4984814),
options: markerOptions,
title: "Olympic National Park"
});
google.maps.event.addListener(marker9, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow9.open(map, marker9); });
var infoWindow10 = new google.maps.InfoWindow({ content: "<h3>Seattle Aquarium<br />1483 Alaskan Way, Seattle, WA 98101</h3>"});
infoWindows.push(infoWindow10);
marker10 = new google.maps.Marker({
position: new google.maps.LatLng(47.607445, -122.3429996),
options: markerOptions,
title: "Seattle Aquarium"
});
google.maps.event.addListener(marker10, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow10.open(map, marker10); });
var infoWindow11 = new google.maps.InfoWindow({ content: "<h3>Pike Place Market<br />85 Pike Street, Seattle, WA 98101</h3>"});
infoWindows.push(infoWindow11);
marker11 = new google.maps.Marker({
position: new google.maps.LatLng(47.6084444, -122.3405493),
options: markerOptions,
title: "Pike Place Market"
});
google.maps.event.addListener(marker11, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow11.open(map, marker11); });
var infoWindow12 = new google.maps.InfoWindow({ content: "<h3>Golden Gate Bridge<br />Golden Gate Bridge, San Francisco, CA 94129</h3>"});
infoWindows.push(infoWindow12);
marker12 = new google.maps.Marker({
position: new google.maps.LatLng(37.8080561, -122.4763625),
options: markerOptions,
title: "Golden Gate Bridge"
});
google.maps.event.addListener(marker12, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow12.open(map, marker12); });
</script>
</head>
<body>
<div id="map-canvas"></div>
<!-- <a href="https://www.chevrolet.com/"><img src="images/chevrolet-logo.png" width="400px" style="position: absolute; bottom: 35px; left: 7px;" /></a> -->
</body>
</html>