title: Google Maps API - Polylines snap to road limit
body: <p>I am building several polylines snap to road. Below the code for 2 of them. Above 15 polylines snap to road, I have the following error: "Directions request failed: OVER_QUERY_LIMIT".</p>
  
  <p>Thus, I'd like to find a solution. One of them would consist in putting all those informations in cache in my computer, so the only thing I get from Google Maps is the map. Is that possible ?</p>
  
  <p>Do you know some other solutions ?</p>
  
  <pre><code>//Circuit CHL1C1
  
  CHL1C1 = [
      new google.maps.LatLng(-22.91401,-68.192237),
      new google.maps.LatLng(-23.226361,-67.064938)
      ];
  
  var traceCHL1C1 = new google.maps.Polyline({
      path: CHL1C1,
      strokeColor: "red",
      strokeOpacity: 1.0,
      strokeWeight: 4
  });
  
  var serviceCHL1C1 = new google.maps.DirectionsService(),traceCHL1C1,snap_pathCHL1C1=[];
  traceCHL1C1.setMap(map);
  for(j=0;j&lt;CHL1C1.length-1;j++){
      serviceCHL1C1.route({origin: CHL1C1[j],destination: CHL1C1[j+1],travelMode: google.maps.DirectionsTravelMode.DRIVING},function(result, status) {
          if(status == google.maps.DirectionsStatus.OK) {
              snap_pathCHL1C1 = snap_pathCHL1C1.concat(result.routes[0].overview_path);
              traceCHL1C1.setPath(snap_pathCHL1C1);
          } else alert("Directions request failed: "+status);        
      });
  }
  
  
  
  
  //Circuit CHL1C2
  
  CHL1C2 = [
      new google.maps.LatLng(-22.898988,-68.198154),
      new google.maps.LatLng(-22.337195,-68.016747),
      new google.maps.LatLng(-22.443062,-68.899408)
  ];
  
  var traceCHL1C2 = new google.maps.Polyline({
      path: CHL1C2,
      strokeColor: "green",
      strokeOpacity: 1.0,
      strokeWeight: 4
  });
  
  var serviceCHL1C2 = new google.maps.DirectionsService(),traceCHL1C2,snap_pathCHL1C2=[];
  traceCHL1C2.setMap(map);
  for(j=0;j&lt;CHL1C2.length-1;j++){
      serviceCHL1C2.route({origin: CHL1C2[j],destination: CHL1C2[j+1],travelMode: google.maps.DirectionsTravelMode.DRIVING},function(result, status) {
          if(status == google.maps.DirectionsStatus.OK) {
              snap_pathCHL1C2 = snap_pathCHL1C2.concat(result.routes[0].overview_path);
              traceCHL1C2.setPath(snap_pathCHL1C2);
          } else alert("Directions request failed: "+status);        
      });
  }
  </code></pre>