-
Notifications
You must be signed in to change notification settings - Fork 0
/
KY_State_Parks.html
110 lines (91 loc) · 4.83 KB
/
KY_State_Parks.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<title>The optimal road trip through all of Kentucky's state parks and historic sites, and its one national park</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?key=AIzaSyBxiavdI9MzT_Ikjn_pfRrMmYRYnFfDUro"></script>
<script>
var routes_list = []
var markerOptions = { icon: "https://maps.gstatic.com/mapfiles/markers2/marker.png" };
var directionsDisplayOptions = {
preserveViewport: true,
markerOptions: markerOptions
};
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
var center = new google.maps.LatLng(39, -96);
var mapOptions = {
zoom: 5,
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);
}
}
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 = ['Butler-Turpin State Historic House, KY', 'General Butler State Resort Park, KY', 'E. P. Tom Sawyer State Park, KY', 'Taylorsville Lake State Park, KY', 'My Old Kentucky Home State Park, KY', 'Lincoln Homestead State Park, KY', 'Perryville Battlefield State Historic Site, KY', 'Old Fort Harrod State Park, KY', 'Isaac Shelby Cemetery State Historic Site, KY', 'William Whitley House State Historic Site, KY', 'Lake Cumberland State Resort Park, KY', 'Dale Hollow Lake State Park, KY', 'Old Mulkey Meetinghouse State Historic Site, KY', 'Barren River Lake State Resort Park, KY', 'Lake Malone State Park, KY', 'Jefferson Davis State Historic Site, KY', 'Mineral Mound State Park, KY', 'Kentucky Dam Village State Resort Park, KY', 'Wickliffe Mounds State Historic Site, KY', 'Columbus-Belmont State Park, KY', 'Kenlake State Resort Park, KY', 'Lake Barkley State Resort Park, KY', 'Pennyrile Forest State Resort Park, KY', 'John James Audubon State Park, KY', 'Rough River Dam State Resort Park, KY', 'Nolin Lake State Park, KY', 'Mammoth Cave National Park', 'Green River Lake State Park, KY', 'General Burnside State Park, KY', 'Cumberland Falls State Resort Park, KY', 'Dr. Thomas Walker State Historic Site, KY', 'Pine Mountain State Scenic Trail, KY', 'Pine Mountain State Resort Park, KY', 'Levi Jackson Wilderness Road State Park, KY', 'Natural Bridge State Resort Park, KY', 'Grayson Lake State Park, KY', 'Carter Caves State Resort Park, KY', 'Greenbo Lake State Resort Park, KY', 'Yatesville Lake State Park, KY', 'Paintsville Lake State Park, KY', 'Dawkins Line Rail Trail, KY', 'Jenny Wiley State Resort Park, KY', 'Fishtrap Lake State Park, KY', 'Breaks Interstate Park, KY', 'Kingdom Come State Park, KY', 'Carr Creek State Park, KY', 'Buckhorn Lake State Resort Park, KY', 'White Hall State Historic Site, KY', 'Fort Boonesborough State Park, KY', 'Boone Station State Historic Site, KY', 'Waveland State Historic Site, KY', 'Blue Licks Battlefield State Park, KY', 'Kincaid Lake State Park, KY', 'Big Bone Lick State Historic Site, KY', 'Butler-Turpin State Historic House, KY']
createRoutes(optimal_route);
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>