title: Google Places not returning complete results with RouteBoxer
body: <p><strong>EDIT: It seems that I'm hitting the query limit, but I'm not being returned a full 200 results. So upon further research it looks like the Google API will let me query 10 boxes, return those results, and then smacks me with an OVER_QUERY_LIMIT status for the rest. So I figure I now have two options: slow my queries, or broaden my distance to create fewer boxes along the route.</strong></p>
  
  <p>I'm currently fooling around building a little web app that provides a details about places along a route (like gas stations and coffee on a road trip). I'm using the Google Maps API with the Places Library and <a href="https://google-maps-utility-library-v3.googlecode.com/svn/trunk/routeboxer/docs/examples.html" rel="nofollow">RouteBoxer</a>. <strong>I'm generating all the appropriate boxes with RouteBoxer, but  when the boxes are passed to the Places Library I'm only getting back some of the places.</strong> Usually I'll get the first half of the route (on shorter routes) or a few random chunks (for longer routes). San Francisco to Seattle returns me gas stations around Seattle and around Medford, OR only.</p>
  
  <p>Initially I thought maybe I was hitting the results cap of 200, but it's making a separate request for each box, and my total results often aren't hitting 200. Results returned are generally pretty consistent from what I can see. When looking at the details of my network requests and responses, it seems that the script is moving through the boxes making requests with the Places library, and suddenly it stops part way through.</p>
  
  <p>The live app where you can see results and boxes is on <a href="https://arcane-island-6450.herokuapp.com/" rel="nofollow">Heroku</a>.</p>
  
  <p>My JavaScript isn't the strongest by any means. That's part of why I wanted to work with this API, so please pardon my ignorance if I'm making a trivial mistake. The full script is below. Any direction is tremendously appreciated!</p>
  
  <pre><code>var infowindow = new google.maps.InfoWindow();
  var map;
  var routeBoxer;
  var service;
  
  function initialize() {
    directionsDisplay = new google.maps.DirectionsRenderer();
    var mapOptions = {
      zoom: 4,
      center: new google.maps.LatLng(39, -98),
      mapTypeId: google.maps.MapTypeId.ROADMAP,
    };
    map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
    service = new google.maps.places.PlacesService(map);
  
    routeBoxer = new RouteBoxer();
  
    directionService = new google.maps.DirectionsService();
    directionsRenderer = new google.maps.DirectionsRenderer({ map: map })
  
    directionsDisplay.setMap(map);
    directionsDisplay.setPanel(document.getElementById('directions-panel'));
  }
  
  function calcRoute() {
    var start = document.getElementById('start').value;
    var end = document.getElementById('end').value;
    var waypt1 = document.getElementById('waypoint1').value;
    var waypt2 = document.getElementById('waypoint2').value;
    var waypts = []
  
    if (waypt1) {
      waypts.push({
        location:waypt1,
        stopover:true});  
    }
    if (waypt2) {
      waypts.push({
        location:waypt2,
        stopover:true});  
    }
  
    var request = {
      origin: start,
      destination: end,
      waypoints: waypts,
      optimizeWaypoints: true,
      travelMode: google.maps.TravelMode.DRIVING
    };
  
    directionService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        directionsDisplay.setDirections(response);
  
        // Build boxes around route
        var path = response.routes[0].overview_path;
        var boxes = routeBoxer.box(path, 2); // distance in km from route
        drawBoxes(boxes);
        for (var i=0; i &lt; boxes.length; i++) {
          var bounds = boxes[i];
          findPlaces(bounds);
          findPlacesByText(bounds);
        }
      } else {
        alert("Directions query failed: " + status);
      }
    });
  }
  
  function findPlaces(bounds) {
    var selectedTypes = []; 
  
    var inputElements = document.getElementsByClassName('placeOption');
  
    for (var i=0; inputElements[i]; i++) {
      if (inputElements[i].checked) {
       selectedTypes.push(inputElements[i].value)
      }
    }
  
    var request = {
      bounds: bounds,
      types: selectedTypes
    };
  
    if (selectedTypes.length &gt; 0) {
      service.radarSearch(request, callback);
    }
  }
  
  function findPlacesByText(bounds) {
    var selectedTypes = ''; 
  
    var inputElements = document.getElementsByClassName('textOption');
  
    for (var i=0; inputElements[i]; i++) {
      if (inputElements[i].checked) {
       selectedTypes += inputElements[i].value + ', '
      }
    }
  
    var request = {
      bounds: bounds,
      query: selectedTypes
    };
  
    if (selectedTypes.length &gt; 0) {
      service.textSearch(request, callback);
    }
  }
  
  function callback(results, status) {
    if (status == google.maps.places.PlacesServiceStatus.OK) {
      for (var i = 0; i &lt; results.length; i++) {
        createMarker(results[i]);
      }
    }
  }
  
  function createMarker(place) {
    var marker = new google.maps.Marker({
      map: map,
      position: place.geometry.location
    });
  
    var request = {
      reference: place.reference
    };
  
    google.maps.event.addListener(marker,'click',function(){
      service.getDetails(request, function(place, status) {
        if (status == google.maps.places.PlacesServiceStatus.OK) {
          var contentStr = '&lt;h5&gt;' + place.name + '&lt;/h5&gt;&lt;p&gt;' + place.formatted_address;
          if (!!place.formatted_phone_number) contentStr += '&lt;br /&gt;' + place.formatted_phone_number;
          if (!!place.website) contentStr += '&lt;br /&gt;&lt;a target="_blank" href="' + place.website + '"&gt;' + place.website + '&lt;/a&gt;';
          contentStr += '&lt;br /&gt;' + place.types + '&lt;/p&gt;';
          infowindow.setContent(contentStr);
          infowindow.open(map,marker);
        } else {
          var contentStr = "&lt;h5&gt;No Result, status=" + status + "&lt;/h5&gt;";
          infowindow.setContent(contentStr);
          infowindow.open(map,marker);
        }
      });
    });
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);
  </code></pre>