Created
December 9, 2015 09:28
-
-
Save UlisesGascon/71182ffbf6df0a2c6c47 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<title>Llegando a Fictizia desde el Metro</title> | |
<style> | |
html, body { | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
#map { | |
height: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script type='text/javascript' src="http://maps.googleapis.com/maps/api/js?sensor=false&extension=.js&output=embed"></script> | |
<script> | |
(function () { | |
var directionsDisplay = new google.maps.DirectionsRenderer; | |
var directionsService = new google.maps.DirectionsService; | |
var map = new google.maps.Map(document.getElementById('map'), { | |
zoom: 14, | |
center: {lat: 40.421612, lng: -3.722537} | |
}); | |
directionsDisplay.setMap(map); | |
calculateAndDisplayRoute(directionsService, directionsDisplay); | |
function calculateAndDisplayRoute(directionsService, directionsDisplay) { | |
directionsService.route({ | |
destination: {lat: 40.422134, lng: -3.718210}, | |
origin: {lat: 40.421480, lng: -3.718334}, | |
travelMode: google.maps.TravelMode.WALKING | |
}, function(response, status) { | |
if (status == google.maps.DirectionsStatus.OK) { | |
directionsDisplay.setDirections(response); | |
} else { | |
console.log('Directions request failed due to ' + status); | |
} | |
}); | |
} | |
}()) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment