var directionsDisplay; var directionsService = new google.maps.DirectionsService(); function initialize() { directionsDisplay = new google.maps.DirectionsRenderer(); var mapOptions = { zoom: 9, mapTypeId: google.maps.MapTypeId.ROADMAP, center: new google.maps.LatLng(40.392581, 21.549683) }; var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById('directions-panel')); } function getLocation(callback) { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { callback({ lat: position.coords.latitude, lon: position.coords.longitude }); },function (error) { alert("Location not found"); }); } else { alert("Location not found"); } } function getStart(callback) { var start = document.getElementById('start').value; if (start == "my_location") { getLocation(function (loc) { start = new google.maps.LatLng(loc.lat, loc.lon); callback(start); }); } else { callback(start); } } function calcRoute() { var end = document.getElementById('end').value; if (end != "") { getStart(function (start) { var request = { origin: start, destination: end, travelMode: google.maps.TravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); }); } } google.maps.event.addDomListener(window, 'load', initialize); (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-76606933-1', 'auto'); ga('send', 'pageview');

Photo Gallery

1
2