title: How to to Get Places (e.g Gas Stations) along Route Between Origin and Destination in Google Maps API
body: <p>Can you please let me know if it is possible to get list of all places for example Gas Stations along Route Between Origin and Destination in Google Maps API? <a href="http://jsfiddle.net/Behseini/w39qP/">Here</a> is a link that I am trying to list all Gas Stations or Rest areas ( or any of Google Maps API Supported Place Types)between two points ans based on a Direction supported route.</p>
  
  <p>and this my code so far:</p>
  
  <pre><code>var directionsDisplay;
  var directionsService = new google.maps.DirectionsService();
  var map;
  var haight = new google.maps.LatLng(49.216364,-122.811897);
  var oceanBeach = new google.maps.LatLng(50.131446,-119.506838);
  
  function initialize() {
    directionsDisplay = new google.maps.DirectionsRenderer();
    var mapOptions = {
    zoom: 14,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    center: haight
  }
    map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
    directionsDisplay.setMap(map);
  
      calcRoute();
   }
  
  function calcRoute() {
    var request = {
    origin: haight,
    destination: oceanBeach,
    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);
  </code></pre>
  
  <p>Edited Part:</p>
  
  <pre><code>// Make the directions request
    directionService.route(request, function(result, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        directionsRenderer.setDirections(result);
  
        // Box around the overview path of the first route
        var path = result.routes[0].overview_path;
        var boxes = routeBoxer.box(path, distance);
        drawBoxes(boxes);
      } else {
        alert("Directions query failed: " + status);
      }
  
        for (var i = 0; i &lt; boxes.length; i++) {
    var bounds = box[i];
    // Perform search over this bounds 
  }
  
  
  
    });
  }
  </code></pre>