Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. var directionsService = new google.maps.DirectionsService();
  2. var directionsDisplay = new google.maps.DirectionsRenderer();
  3.  
  4. var myOptions = {
  5. zoom:7,
  6. mapTypeId: google.maps.MapTypeId.ROADMAP
  7. }
  8.  
  9. var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  10. directionsDisplay.setMap(map);
  11.  
  12. var request = {
  13. origin: '<?php echo $orgcitname; ?>',
  14. destination: '<?php echo $descitname; ?>',
  15. travelMode: google.maps.DirectionsTravelMode.DRIVING
  16. };
  17.  
  18. directionsService.route(request, function(response, status) {
  19. if (status == google.maps.DirectionsStatus.OK) {
  20. directionsDisplay.setDirections(response);
  21. }
  22. });
  23.  
  24. directionsDisplay.setMap();
  25.  
  26. var myOptions = {
  27. zoom:7,
  28. mapTypeId: google.maps.MapTypeId.ROADMAP
  29. }
  30.  
  31. var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement