-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.html
51 lines (44 loc) · 1.38 KB
/
map.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
<!DOCTYPE html>
<html>
<head>
<style>
#map {
height: 300px;
width: 100%;
}
</style>
</head>
<body style="margin: 0; padding: 0;">
<div id="map"></div>
<script>
function calculateAndDisplayRoute(directionsService, directionsDisplay) {
directionsService.route({
origin: "Nakaitabashi Station",
destination: "173-0021 Tokyo-to, Itabashi-ku, Yayoichō, 40−7",
travelMode: 'WALKING'
}, function(response, status) {
if (status === 'OK') {
directionsDisplay.setDirections(response);
} else {
window.alert('Directions request failed due to ' + status);
}
});
}
function initMap()
{
var directionsService = new google.maps.DirectionsService;
var directionsDisplay = new google.maps.DirectionsRenderer;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 7,
center: {lat: 35.7562022, lng: 139.6924972, zoom: 17}
});
window.mapContents = map;
directionsDisplay.setMap(map);
calculateAndDisplayRoute(directionsService, directionsDisplay);
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDZDTW0XaQ3Qd3RVFtvGpiziwEQwGasEA4&callback=initMap">
</script>
</body>
</html>