-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaps.php
99 lines (78 loc) · 3.34 KB
/
maps.php
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Blackout</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAsgqWSIQltBwZ838YNyxQnRT2tVxuwsOEhjl6IPUZleOhibtmWxQYQbyhIzw9XcL35iRPea1QQ31SRQ" type="text/javascript"></script>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="center">
<form id="stop-form" action="" method="get"> Address<br />
<input id="address" type="text" name="address" value="" /><br />
<br />
<input id="submit" type="Submit" value="Submit"/>
</form>
<script type="text/javascript">
var map;
var directionsService = new google.maps.DirectionsService();
var directionsDisplay;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var myOptions = {
zoom:7,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map($("#map_canvas")[0], myOptions);
directionsDisplay.setMap(map);
}
// $(window).load(initialize);
// $('#submit').click(plot_directions);
var latlngs;
var start;
var end;
var waypts;
var latlngs_start;
var latlngs_end;
function plot_directions() {
latlngs = [ new google.maps.LatLng(40.487978, -74.439342), new google.maps.LatLng(40.487978, -74.439342), new google.maps.LatLng(40.498187, -74.445195), new google.maps.LatLng(40.5041, -74.449091), new google.maps.LatLng(40.523768, -74.458305), new google.maps.LatLng(40.51992, -74.433583), new google.maps.LatLng(40.533959, -74.436622), new google.maps.LatLng(40.485633, -74.437406), new google.maps.LatLng(40.499666, -74.445021), new google.maps.LatLng(40.502681, -74.451444),
];
latlngs_start = new google.maps.LatLng(40.487978, -74.439342);
latlngs_end = new google.maps.LatLng(40.487978, -74.439342);
latlngs = latlngs.splice(0,1);
latlngs = latlngs.splice(0,latlngs.length-1);
start = latlngs_start; //document.getElementById("start").value;
end = latlngs_end;//document.getElementById("end").value;
var waypts = [];
for (var i = 0 ; i < latlngs.length ; i++ ) {
waypts.push({
location:latlngs[i],
stopover:true
});
}
var request = {
origin: start,
destination: end,
waypoints: waypts,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
var route = response.routes[0];
// For each route, display summary information.
}
});
return false;
};
</script>
<div id="table_div"> </div>
<span id="closest_span"> </span>
<span id="map_text"> </span>
<div id="map_canvas" style="width: 800px"> asdfasdfasdfasdfasdfsadf </div>
</div>
</body>
</html>