Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps API v3: Handle usage Limit restriction
    primarykey
    data
    text
    <p>Google maps has a limit on the API usage: All web services Rate limit of 10 requests per second, per web service. The Google Places API has separate usage limits. Ref: <a href="https://developers.google.com/maps/documentation/business/faq#js_usage_limits" rel="nofollow">Google Maps API Usage Limit</a></p> <p>I have sending more than 10 requests to Google Maps API. Below is a sample code that I have written using <a href="http://code.google.com/p/jquery-ui-map/wiki/Examples" rel="nofollow">JQuery.ui.maps</a> :</p> <pre><code> $('#map').gmap('displayDirections', { 'origin': new google.maps.LatLng(42.645573,-71.098326), 'destination': new google.maps.LatLng(42.345573,-72.298326), 'travelMode': google.maps.DirectionsTravelMode.DRIVING }, {suppressMarkers: true},function(success, result) { if ( success ) alert('Results found!'); }); </code></pre> <p>I have updated the following jquery function as per my requirements. I have added a sleep/delay of 1 second for each request.</p> <pre><code>displayDirections: function(current, directionsRequest, directionsRendererOptions, callback) { alert("displayDirections "+current); var startTime = new Date().getTime(); // get the current time while (new Date().getTime() &lt; startTime + 1000) { } // hog cpu var self = this; var directionService = this.get('services &gt; DirectionsService', new google.maps.DirectionsService()); var directionRenderer =new google.maps.DirectionsRenderer(directionsRendererOptions); directionService.route(directionsRequest, function(results, status) { alert("directionService Called " + current); var startTime = new Date().getTime(); // get the current time while (new Date().getTime() &lt; startTime + 1000) { } // hog cpu if ( status === 'OK' ) { directionRenderer.setDirections(results); directionRenderer.setMap(self.get('map')); } else { alert(status) directionRenderer.setMap(null); } self.get('directionRenderers').push(directionRenderer); callback(results, status); }); } </code></pre> <p>But it is not working as required. Can someone help me by showing how to work around this restriction.</p> <p>Let me know in case if more details are required.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload