The Google Directions API Query limit

1,822 views
Skip to first unread message

Andrius Virbičianskas

unread,
Dec 1, 2011, 4:20:25 AM12/1/11
to google-maps-ap...@googlegroups.com
Dear Google,

Please find some time to explain why the 2500 query per 24 hours limit is always 10 times less? I always hit the limit of 250 q/day. And from a quick search it seems, that there's a lot of questions about this matter, but no official answers. I'd appreciate if you'd fix the Limits description or actually allow us to have 2500 queries per day. Thank you.

Luke Mahé

unread,
Dec 4, 2011, 10:25:05 PM12/4/11
to google-maps-ap...@googlegroups.com
Hi,

The limit is 2500 per 24 hours but there is also a query per second limit - so you can't do something 2500 in 5 seconds. How may queries are you doing in what timeframe?

-- Luke


2011/12/1 Andrius Virbičianskas <andrius.vi...@gmail.com>
Dear Google,

Please find some time to explain why the 2500 query per 24 hours limit is always 10 times less? I always hit the limit of 250 q/day. And from a quick search it seems, that there's a lot of questions about this matter, but no official answers. I'd appreciate if you'd fix the Limits description or actually allow us to have 2500 queries per day. Thank you.

--
You received this message because you are subscribed to the Google Groups "Google Maps API Web Services" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-api-web-services/-/z8gyMz-Mp44J.
To post to this group, send email to google-maps-ap...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api-web-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api-web-services?hl=en.

Andrius Virbičianskas

unread,
Dec 12, 2011, 5:03:21 AM12/12/11
to google-maps-ap...@googlegroups.com
Tried 1 query per 5 sec. But even if there's a limit per second/minute/hour, why this isn't stated in the Directions API Limits description? In addition to that, shouldn't those limits expire after second/minute/hour and I would be able to query again? I do understand that there might be some throttling, but it doesn't work the way it suppose to.

Barry Hunter

unread,
Dec 12, 2011, 7:16:27 AM12/12/11
to google-maps-ap...@googlegroups.com
To get full access to the full allocation, you actully looking at
about a 34.5 second delay - space the results over the whole 24 hours.

A common way is to use an adaptive delay. Say start with spacing 1
second. Then if you get a quota denieal, double the delay and then try
again. To avoid the delay going out of control, due to blips, could
say reduce the delay by 2 seconds for every 10 successive successes.
This way your script can learn a good delay.


2011/12/12 Andrius Virbičianskas <andrius.vi...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API Web Services" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/google-maps-api-web-services/-/6aJQf-Kgne0J.

Pim Duijst

unread,
Dec 12, 2011, 4:40:02 PM12/12/11
to google-maps-ap...@googlegroups.com
@Luke, we are facing the same problem!

We use Google Directions to calculate the duration between two points. Each day we fire between 200 and 400 queries to the database. Which according to your documentation should be no problem. But when we reach the limit of 250 less or more we get the status "OVER_QUERY_LIMIT". As you suggest to use a timeframe, we are using a variable delay between 1,2, or 3 seconds. We can't increase the delay any higher because that would make our application act very slow which is not acceptable for the endusers.

So increasing the timeframe isn't an option for us. Just like rebuilding our websolution from serverside to clientside isn't also a solution because we store data received from the Directions API in the database and use it to compare it with other data to display information.

We are facing this problem now for over a week. Can you please come up with a good solution? If neccesary I'll leave a phonenumber in a personal message to call me.

Yours,

Pim

Chris Broadfoot

unread,
Dec 12, 2011, 6:54:28 PM12/12/11
to google-maps-ap...@googlegroups.com
Hi Pim,

I'd suggest either re-architecting your application to take directions data from the user, or purchase a Maps API Premier license:

Premier license gives you 100K queries per day.

--
You received this message because you are subscribed to the Google Groups "Google Maps API Web Services" group.

Pim Duijst

unread,
Dec 13, 2011, 2:48:10 AM12/13/11
to google-maps-ap...@googlegroups.com
Hi Chris,

I am aware of the extra options that Premier gives me. But why should I ever do that if I don't even get close to the daily limit that should be available for me? What I need is a proper solution for this to solve this.

Is there anyone?

2011/12/13 Chris Broadfoot <cb...@google.com>



--
||Pim Duijst||www.pimduijst.nl||

Chris Broadfoot

unread,
Dec 13, 2011, 4:03:58 AM12/13/11
to google-maps-ap...@googlegroups.com
On Tue, Dec 13, 2011 at 6:48 PM, Pim Duijst <pimd...@gmail.com> wrote:
But why should I ever do that if I don't even get close to the daily limit that should be available for me?

I don't know how else to say this: several people in this thread have told you how the quota system works - if you want something different, please contact our enterprise sales team.

Pim Duijst

unread,
Dec 13, 2011, 4:11:43 AM12/13/11
to google-maps-ap...@googlegroups.com
Hey Chris,

It's not that I want something else, I just want a solution for why we are reaching our limit (according to Google) when we hit 250 calls a day instead of the 2500 which Google promises.

2011/12/13 Chris Broadfoot <cb...@google.com>
--
You received this message because you are subscribed to the Google Groups "Google Maps API Web Services" group.
To post to this group, send email to google-maps-ap...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api-web-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api-web-services?hl=en.



--
||Pim Duijst||www.pimduijst.nl||

Andrius Virbičianskas

unread,
Dec 13, 2011, 4:38:42 AM12/13/11
to google-maps-ap...@googlegroups.com
Ok, so I tried requests with 35sec delay. And guess what? It doesn't work! At least properly. After ~250 requests or so started getting OVER_QUERY_LIMIT. True that some requests still passed and response was good. But it was like: 2 good, 2 bad, 1 good, 3 bad and so on... 

No matter how you look at it, throttling is broken and a suggestion to buy premiere license is a killer for small business. I mean, 10k USD per year because of lousy 300-400 reqs per day? You gotta be joking. I only want that throttling would be properly fixed! You state that there's 2500 reqs/day limit, then please show us the correct way to get all of that number. 

P.S. It seems that it doesn't work after all. Already got 12 OVER_QUERY_LIMIT responses in a row and still counting. This time even with a 40sec delay.

Pim Duijst

unread,
Dec 13, 2011, 5:16:38 AM12/13/11
to google-maps-ap...@googlegroups.com
Well it we tried to use a dynamic delay which increments with 5 secs but that doesn't work either...

Come on Google, you say we have a limit of 2500 each 24 hours to query the API. But that doesn't work, or come with a proper fix or with some possible solution we are doing wrong...



2011/12/13 Andrius Virbičianskas <andrius.vi...@gmail.com>
Ok, so I tried requests with 35sec delay. And guess what? It doesn't work! At least properly. After ~250 requests or so started getting OVER_QUERY_LIMIT. True that some requests still passed and response was good. But it was like: 2 good, 2 bad, 1 good, 3 bad and so on... 

No matter how you look at it, throttling is broken and a suggestion to buy premiere license is a killer for small business. I mean, 10k USD per year because of lousy 300-400 reqs per day? You gotta be joking. I only want that throttling would be properly fixed! You state that there's 2500 reqs/day limit, then please show us the correct way to get all of that number. 

P.S. It seems that it doesn't work after all. Already got 12 OVER_QUERY_LIMIT responses in a row and still counting. This time even with a 40sec delay.

--
You received this message because you are subscribed to the Google Groups "Google Maps API Web Services" group.

To post to this group, send email to google-maps-ap...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api-web-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api-web-services?hl=en.



--
||Pim Duijst||www.pimduijst.nl||

Barry Hunter

unread,
Dec 13, 2011, 8:01:26 AM12/13/11
to google-maps-ap...@googlegroups.com
Are you perhaps sharing you IP with others? The limit is per IP
address. If on a shared serve, or a shared proxy/internet connection.

2011/12/13 Andrius Virbičianskas <andrius.vi...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API Web Services" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/google-maps-api-web-services/-/caBDRCs2lgMJ.

Andrius Virbičianskas

unread,
Dec 13, 2011, 8:09:26 AM12/13/11
to google-maps-ap...@googlegroups.com
No, I'm not. I have dedicated IP address on my dev machine and no one except me uses it. So my money is still on the side, that google's throttling ain't working properly. That, or maybe the actual limit is 250 instead of 2500. Is there anyone who actually got pass 250 limit?

P.S. Maybe there's a mistype in their config file? It's easy to loose one zero :) Check it google guys. Not that hard IMO :)

Pim Duijst

unread,
Dec 13, 2011, 8:15:47 AM12/13/11
to google-maps-ap...@googlegroups.com
Andrius, I totally agree with you!

It seems that they don't care about us and want us to pay...

Cause at the moment Google isn't doing anything I'm trying for an alternative API ;-)

2011/12/13 Andrius Virbičianskas <andrius.vi...@gmail.com>
No, I'm not. I have dedicated IP address on my dev machine and no one except me uses it. So my money is still on the side, that google's throttling ain't working properly. That, or maybe the actual limit is 250 instead of 2500. Is there anyone who actually got pass 250 limit?

P.S. Maybe there's a mistype in their config file? It's easy to loose one zero :) Check it google guys. Not that hard IMO :)

--
You received this message because you are subscribed to the Google Groups "Google Maps API Web Services" group.

To post to this group, send email to google-maps-ap...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api-web-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api-web-services?hl=en.



--
||Pim Duijst||www.pimduijst.nl||

Chris Broadfoot

unread,
Dec 13, 2011, 10:03:56 AM12/13/11
to google-maps-ap...@googlegroups.com
Sorry, Pim. It's 2 AM here in Sydney, and no one on the API team (other than me) is awake.

I'll investigate tomorrow.

Cheers
Chris

Pim Duijst

unread,
Dec 13, 2011, 10:07:45 AM12/13/11
to google-maps-ap...@googlegroups.com
Yes well...

We don't have a tomorrow. This must be fixed asap! Can't I contact you on skype or whatever?

2011/12/13 Chris Broadfoot <cb...@google.com>



--
||Pim Duijst||www.pimduijst.nl||

Andres Ferrate

unread,
Dec 13, 2011, 10:26:39 AM12/13/11
to Google Maps API Web Services
Pim:

While I understand your frustration I think perhaps it is misguided
here. If the work you are doing is so critical that it needs to be
fixed ASAP, then I would suggest that you explore your options with
regard to Premier licensing, which does provide added benefits, such
as dedicated support, SLA, etc. in addition to higher rate limits.

Hundreds of thousands of sites use the Google Maps API and thousands
of developers successfully use the Maps API Web Services on a daily
basis without running into the issue you have described. As Chris
mentioned, we'll take a look into this, but I can assure you that the
forums would be inundated with requests if our API was somehow capped
at 250 requests per day, as you stipulate.

Perhaps it's worth verifying, as you mentioned in your earlier post,
whether perhaps there is a mistype in your code.

We'll keep you posted if Chris or other members of the team discover
any additional information relevant to your issue.

Thanks,

Andres

On Dec 13, 10:07 am, Pim Duijst <pimdui...@gmail.com> wrote:
> Yes well...
>
> We don't have a tomorrow. This must be fixed asap! Can't I contact you on
> skype or whatever?
>

> 2011/12/13 Chris Broadfoot <c...@google.com>


>
>
>
>
>
>
>
>
>
> > Sorry, Pim. It's 2 AM here in Sydney, and no one on the API team (other
> > than me) is awake.
>
> > I'll investigate tomorrow.
>
> > Cheers
> > Chris
>
> > --
> > G+:http://chrisbroadfoot.id.au/+
> > Twitter:http://twitter.com/broady
>

> > On Wed, Dec 14, 2011 at 12:15 AM, Pim Duijst <pimdui...@gmail.com> wrote:
>
> >> Andrius, I totally agree with you!
>
> >> It seems that they don't care about us and want us to pay...
>
> >> Cause at the moment Google isn't doing anything I'm trying for an
> >> alternative API ;-)
>

> >> 2011/12/13 Andrius Virbičianskas <andrius.virbicians...@gmail.com>


>
> >>> No, I'm not. I have dedicated IP address on my dev machine and no one
> >>> except me uses it. So my money is still on the side, that google's
> >>> throttling ain't working properly. That, or maybe the actual limit is 250
> >>> instead of 2500. Is there anyone who actually got pass 250 limit?
>
> >>> P.S. Maybe there's a mistype in their config file? It's easy to loose
> >>> one zero :) Check it google guys. Not that hard IMO :)
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Google Maps API Web Services" group.
> >>> To view this discussion on the web visit

> >>>https://groups.google.com/d/msg/google-maps-api-web-services/-/ZcKfU3...


> >>> .
> >>> To post to this group, send email to
> >>> google-maps-ap...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> google-maps-api-web-...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-maps-api-web-services?hl=en.
>
> >> --

> >> *||Pim Duijst||www.pimduijst.nl*||


>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Google Maps API Web Services" group.
> >> To post to this group, send email to
> >> google-maps-ap...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-maps-api-web-...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-maps-api-web-services?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Google Maps API Web Services" group.
> > To post to this group, send email to
> > google-maps-ap...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-maps-api-web-...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-maps-api-web-services?hl=en.
>
> --

> *||Pim Duijst||www.pimduijst.nl*||

Pim Duijst

unread,
Dec 13, 2011, 10:34:18 AM12/13/11
to google-maps-ap...@googlegroups.com
Andres,

What I see is that there are also a lot of developers who get stuck on the usage limit while they all stated clearly that they do NOT cross the limit of 2500 per 24 hours. You are correct that some mistype is easily made but I know my code well. So what I would suggest is to check yours. A mistype of 2500 and 250 is also easily made ;-)

Thanks,

Pim

2011/12/13 Andres Ferrate <and...@google.com>



--
||Pim Duijst||www.pimduijst.nl||

Luke Mahé

unread,
Dec 13, 2011, 4:44:05 PM12/13/11
to google-maps-ap...@googlegroups.com
Hi Pim,

While we look into this can I get a better understanding about what you are doing and how you are hitting the limits? Also what is the reason that you are using the web service instead of the JS AP? A link to your demo would help.

Thanks

-- Luke

Andrius Virbičianskas

unread,
Dec 14, 2011, 2:04:12 AM12/14/11
to google-maps-ap...@googlegroups.com
It's amazing how google easily avoids the issue just by offering to spend a huge amount of money. And just because their free service doesn't work. And it really doesn't! Some links:

http://stackoverflow.com/questions/5601790/distances-between-houses-google-directions-api-query-limit-is-too-low-need-bet

Guys, please understand this:

1. A lot of people hit 250 limit instead of 2500. Personally I tried with delays from 0.5sec to 40sec between requests. The result is the same. Sample url(coordinates differ per request): http://maps.googleapis.com/maps/api/directions/json?sensor=false&mode=walking&origin=54.68902,25.33088&destination=54.69302,25.3421
2. If we are doing something wrong - tell us and give an example of what is the correct to get all of 2500 requests. 
3. If the actual limit is 250. Fix the damn description!

I am already repeating myself... Is my english so bad, that a lot of my questions are just ignored/misunderstood and instead useless advises are given? Have you actually tried reaching the limits yourselves? Can anyone with 100% certainty say they get all of those 2500??

I'm already beyond frustration. And when I see people avoiding the issue at hand, it just infuriates me. It feels like I'm speaking to sales people instead of tech guys. The again, that would explain a lot... Anyway, if you are not fixing this, say it! I'm tired of waiting and, as others, will move on to another service provider. Not that google cares, but neither do I. I've already wasted enough time of what felt like banging my head to a wall. Enough is enough.

P.S. If you say everything works, please re-read bold text!

Pim Duijst

unread,
Dec 14, 2011, 7:22:25 AM12/14/11
to google-maps-ap...@googlegroups.com
Hi Luke,

Our demo is only available in a network. So instead I'll send you some code


Therefore isn't it possible to try Google Premier for a short period instead of buying for a year?

<?php
class Grd {
  
  //configuration
  
  //reserved
  var $start = "";
  var $destination = "";
  
  var $distance = "";
  var $duration = "";
  
  //buffer
  var $result = "";
  var $response = "";
  var $status = "";
  var $status_code = "";
  var $status_text = "";

  public function Grd()
  {
 
  }
  
  public function set_start($address) 
  {
    //sets start for route 
    $this->start = $address;
  }
  
  public function set_destination($address) 
  {
//sets destination for route 
    $this->destination = $address;
  }

 public function run($incidentID=0)
  {
  sleep(10);
  global $__database;  
 
//use curl to retrieve route and information form google maps
  $this->_retrieve_route();
//convert string result to array
$this->_convert_result();
//set basic vars in class root
$this->status = $this->_get_status_boolean($this->result->status);
$this->status_text = $this->_get_status_text($this->result->status);
$this->status_code = $this->result->status;
if ($this->status_code == "200" || $this->status_code == "OK") {
      
$this->duration = $this->result->routes[0]->legs[0]->duration->value;
      $this->distance = $this->result->routes[0]->legs[0]->distance->value;
     
      $url1 = $this->url;
//add url variables
$url1 = str_replace('{start}', urlencode($this->start), $url1);
$url1 = str_replace('{destination}', urlencode($this->destination), $url1);
     
      $sql="INSERT INTO `tblTrackSuccesCalls` (`pkTrackSuccesID`, `apiCallsDate`, `apiCallsTime`) VALUES (NULL,'".date('Y-m-d')."','".date('H:i:s')."')";
     
      $__database->executeQuery($sql);    
      $to = "someaddress";
      $subject = "Succes Google Maps Direction ".$this->status_code;
      $message = "API call succes with status: ".$this->status_code." and start: ".$this->start." and destination: ".$this->destination." and incidentID: ".$incidentID." on: ".date("H:i:s")." and url: ".$url1;
      mail($to, $subject, $message);
}
else{
$url1 = $this->url;
//add url variables
$url1 = str_replace('{start}', urlencode($this->start), $url1);
$url1 = str_replace('{destination}', urlencode($this->destination), $url1);
      $sql="INSERT INTO `tblTrackFailCalls` (`pkTrackFailID`, `apiCallsDate`, `apiCallsTime`, `apiStatus`, `fkIncidentID`) VALUES (NULL, '".date('Y-m-d')."','".date('H:i:s')."', '".$this->status_code."', '".$incidentID."');";
      $__database->executeQuery($sql);
     
      $to = "someaddress";
      $subject = "Failed Google Maps Direction ".$this->status_code;
      $message = "API call failed with status: ".$this->status_code." and start: ".$this->start." and destination: ".$this->destination." and incidentID: ".$incidentID." on: ".date("H:i:s")." and url: ".$url1;
      mail($to, $subject, $message);
     
}
  }
  
  
  private function _retrieve_route()
  {
   
//init curl (cmd line html browser)
$ch = curl_init();
//config curl
    curl_setopt($ch, CURLOPT_URL, $this->_get_route_url());
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
//curl result
    $this->response = curl_exec($ch);
    curl_close($ch);
  }

  private function _get_route_url()
  {
//get url template
    $url = $this->url;
//add url variables
$url = str_replace('{start}', urlencode($this->start), $url);
$url = str_replace('{destination}', urlencode($this->destination), $url);
return $url;
  }
  
  private function _convert_result()
  {
//get result string
    $result = $this->response; 
//use JSON to convert string to object
$this->result = json_decode($result);  
  }
  
  private function _get_status_text($code)
  {
    switch($code) {
 default:
   return $code;
break;
 case "200":
 case "OK":
   return "succes";
break;
 case "OVER_QUERY_LIMIT";
return "limit reached"; 
 break;
 case "400":
   return "format error";
   break;
 
 case "600":
 case "602":
   return "cannot find address";
   break;
    }
  }
  
  private function _get_status_boolean($code)
  {
    switch($code) {
 default:
   return FALSE;
break;
 case "200":
 case "OK":
   return TRUE;
break;

    }
    
  }

  
}

?>



2011/12/13 Luke Mahé <lu...@google.com>



--
||Pim Duijst||www.pimduijst.nl||

Andrius Virbičianskas

unread,
Dec 14, 2011, 8:21:52 AM12/14/11
to google-maps-ap...@googlegroups.com
Not sure what you guys did, but it finally works. I don't hit 250 limit anymore. Thank you!

Pim Duijst

unread,
Dec 15, 2011, 3:32:06 AM12/15/11
to google-maps-ap...@googlegroups.com
Hey Luke,

I was wondering, if you need 2 API's as we have. We use Google Directions and Google Maps (for finding addresses). They both have a limit of 2500, does that mean I can call each API 2500 times or 2500 times in total?

2011/12/13 Luke Mahé <lu...@google.com>



--
||Pim Duijst||www.pimduijst.nl||

Pim Duijst

unread,
Dec 15, 2011, 3:46:26 AM12/15/11
to google-maps-ap...@googlegroups.com
Hey Luke,

Is it also possible to take Google Premier for a shorter period than a year? Like 1 month or 1 week?

2011/12/13 Luke Mahé <lu...@google.com>



--
||Pim Duijst||www.pimduijst.nl||
Reply all
Reply to author
Forward
0 new messages