Guest User

Untitled

a guest
Mar 19th, 2019
69
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var directionDisplay;
  2. var directionsService = new google.maps.DirectionsService();
  3. var map;
  4.  
  5. var start = new google.maps.LatLng(51.47482547819850,-0.37739553384529);
  6. var myOptions = {
  7. zoom:7,
  8. mapTypeId: google.maps.MapTypeId.ROADMAP,
  9. center: start
  10. }
  11. map = new google.maps.Map(document.getElementById("map"), myOptions);
  12.  
  13. function renderDirections(result) {
  14. var directionsRenderer = new google.maps.DirectionsRenderer();
  15. directionsRenderer.setMap(map);
  16. directionsRenderer.setDirections(result);
  17. }
  18.  
  19. function requestDirections(start, end) {
  20. directionsService.route({
  21. origin: start,
  22. destination: end,
  23. travelMode: google.maps.DirectionsTravelMode.DRIVING
  24. }, function(result) {
  25. renderDirections(result);
  26. });
  27. }
  28.  
  29. for(i=0;i<add.length;i++)
  30. {
  31. requestDirections(start_add[i], end_address[i]);
  32. }
  33. }
RAW Paste Data