-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiple_paths_v2.html
74 lines (66 loc) · 2.1 KB
/
multiple_paths_v2.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
CTYPE html>
<html>
<head>
<style>
html,
body,
#map_canvas {
margin: 0;
padding: 0;
height: 100%
}
</style>
</head>
<body>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<div id="map_canvas"></div>
<script>
var location1 = new google.maps.LatLng(34.04429454929703, -118.22793351693724);
var location2 = new google.maps.LatLng(33.688522885631706, -116.15151750131224);
var location3 = location1;
var location4 = location2;
var map;
var mapOptions = {
center: new google.maps.LatLng(42.5584308, -70.8597732),
zoom: 3,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
function initialize() {
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer({
suppressMarkers: false,
suppressInfoWindows: true
});
directionsDisplay.setMap(map);
var request = {
origin: location1,
destination: location2,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
//directionsService = new google.maps.DirectionsService();
directionsDisplay2 = new google.maps.DirectionsRenderer({
suppressMarkers: false,
suppressInfoWindows: true
});
directionsDisplay2.setMap(map);
var request = {
origin: location3,
destination: location4,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay2.setDirections(response);
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</body>
</html>