-
-
Save juliaogris/2d3b96ac3e981c8c3051 to your computer and use it in GitHub Desktop.
Simple Google Map
This file contains 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> | |
<body> | |
<div id="map" style="position: absolute; width: 100%; height: 100%"></div> | |
<script type="text/javascript"> | |
function init(){ | |
var map = new google.maps.Map(document.getElementById('map'), { | |
center: new google.maps.LatLng(37, -95), | |
zoom: 5 | |
}); | |
var directionsService = new google.maps.DirectionsService; | |
var directionsRenderer = new google.maps.DirectionsRenderer; | |
directionsRenderer.setMap(map); | |
directionsService.route({ | |
origin: 'San Diego, CA', | |
destination: 'Hanover, NH', | |
travelMode: google.maps.TravelMode.DRIVING | |
}, function(directions){ | |
directionsRenderer.setDirections(directions); | |
}); | |
} | |
</script> | |
<script src="https://maps.googleapis.com/maps/api/js?callback=init" defer async></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment