-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathchevrolet-family-road-trip-texas.html
230 lines (173 loc) · 10.3 KB
/
chevrolet-family-road-trip-texas.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
<!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 Texas Family Road Trip by Chevrolet.">
<meta name="author" content="Chevrolet">
<title>The Texas 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;
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(31, -96.75);
var mapOptions = {
zoom: 8,
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);
}
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 = ['8525 Garland Rd, Dallas, TX 75218', '1 Hope Blvd, Galveston, TX 77554', '1601 E NASA Pkwy, Houston, TX 77058', '1500 Binz St, Houston, TX 77004', '588 S Union Ave, New Braunfels, TX 78130', '300 Alamo Plaza, San Antonio, TX 78205', '10500 Sea World Dr, San Antonio, TX\u200e', '1629 Park Rd 59, Glen Rose, TX 76043', '1989 Colonial Pkwy, Fort Worth, TX 76110', '2201 E Road to Six Flags St, Arlington, TX 76010']
createRoutes(optimal_route);
google.maps.event.addDomListener(window, 'load', initialize);
var infoWindow1 = new google.maps.InfoWindow({ content: "<h3>The Rory Meyers Children's Adventure Garden<br />Dallas Arboretum and Botanical Garden<br />8525 Garland Rd, Dallas, TX 75218</h3>"});
infoWindows.push(infoWindow1);
marker1 = new google.maps.Marker({
position: new google.maps.LatLng(32.8211475, -96.716681),
options: markerOptions,
title: "The Rory Meyers Children's Adventure Garden - Dallas Arboretum and Botanical Garden"
});
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>Moody Gardens<br />1 Hope Blvd, Galveston, TX 77554</h3>"});
infoWindows.push(infoWindow2);
marker2 = new google.maps.Marker({
position: new google.maps.LatLng(29.2730284, -94.8506598),
options: markerOptions,
title: "Moody Gardens"
});
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>Space Center Houston<br />1601 E NASA Pkwy, Houston, TX 77058</h3>"});
infoWindows.push(infoWindow3);
marker3 = new google.maps.Marker({
position: new google.maps.LatLng(29.549782, -95.0957914),
options: markerOptions,
title: "Space Center Houston"
});
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>Children’s Museum of Houston<br />1500 Binz St, Houston, TX 77004</h3>"});
infoWindows.push(infoWindow4);
marker4 = new google.maps.Marker({
position: new google.maps.LatLng(29.7225935, -95.3850803),
options: markerOptions,
title: "Children’s Museum of Houston"
});
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>Schlitterbahn Waterpark<br />588 S Union Ave, New Braunfels, TX 78130</h3>"});
infoWindows.push(infoWindow5);
marker5 = new google.maps.Marker({
position: new google.maps.LatLng(29.706318, -98.1173013),
options: markerOptions,
title: "Schlitterbahn Waterpark"
});
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>The Alamo<br />300 Alamo Plaza, San Antonio, TX 78205</h3>"});
infoWindows.push(infoWindow6);
marker6 = new google.maps.Marker({
position: new google.maps.LatLng(29.425745, -98.4861562),
options: markerOptions,
title: "The Alamo"
});
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>Sea World<br />10500 Sea World Dr, San Antonio, TX</h3>"});
infoWindows.push(infoWindow7);
marker7 = new google.maps.Marker({
position: new google.maps.LatLng(29.4583528, -98.7001956),
options: markerOptions,
title: "Sea World"
});
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>Dinosaur Valley State Park<br />1629 Park Rd 59, Glen Rose, TX 76043</h3>"});
infoWindows.push(infoWindow8);
marker8 = new google.maps.Marker({
position: new google.maps.LatLng(32.2480584, -97.8167426),
options: markerOptions,
title: "Dinosaur Valley State Park"
});
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>Fort Worth Zoo<br />1989 Colonial Pkwy, Fort Worth, TX 76110</h3>"});
infoWindows.push(infoWindow9);
marker9 = new google.maps.Marker({
position: new google.maps.LatLng(32.7210971, -97.3560292),
options: markerOptions,
title: "Fort Worth Zoo"
});
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>Six Flags Over Texas<br />2201 E Road to Six Flags St, Arlington, TX 76010</h3>"});
infoWindows.push(infoWindow10);
marker10 = new google.maps.Marker({
position: new google.maps.LatLng(32.7524928, -97.0699775),
options: markerOptions,
title: "Six Flags Over Texas"
});
google.maps.event.addListener(marker10, "mouseover", function() { for (var i = 0; i < infoWindows.length; i++) { infoWindows[i].close(); }; infoWindow10.open(map, marker10); });
</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>