gmapsdistance API key is set, still "You must use an API key to authenticate each request"

Hi,

I have table (protention.xlsx) imported with data about the home and office addresses of different people, and I would like to calculate how long does it take for them to arrive at work from home each morning.
My account and Google maps API is set up properly, and I get the expected results with individual addresses, however, when I use a full table of data (few thousand examples) I get the following error message:

library(gmapsdistance)

gmapsdistance(origin = protention$addressHome, destination = protention$addressWork, mode = "transit", arr_date = "2020-03-02", arr_time = "09:00:00", combinations = "pairwise", key = "myAPIkey")

#> Google API returned an error: You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account

Can you please help me if it might be something with my code or the limitation of the package?

from the docs : https://cran.r-project.org/web/packages/gmapsdistance/readme/README.html

Usage limits

There are a set of limits to the number of calls that can be done. These limits are established by the Google Maps Distance Matrix API Currently, in the free version the limits are given by: 1. 2,500 free elements per day, calculated as the sum of client-side and server-side queries. 2. Maximum of 25 origins or 25 destinations per request. 3. 100 elements per request. 4. 100 elements per second, calculated as the sum of client-side and server-side queries.

though I'm not sure this is the answer, as presumably if you used up all your requests, then it would also being to fail on single handcrafted requests, but you didnt mention any problem of that kind.

Thanks for the answer.
I am on premium account and in theory have unlimited amount of requests. I have checked the quotas page and I have used like 10 so far, so it is surely not the issue that I ran out of requests.

does this function return your api key ?
gmapsdistance::get.api.key()

Yes it returns my API key properly. As mentioned above, the function works perfectly well for a individual addresses.

Here is the github for the project that seems to have a fairly active issues tracker:

Thank you. I read it before and did not find answer there either.

you can raise your own issue

The development of {gmapsdistance} is not very active at preset; it is possible the package may be somewhat buggy (the Google APIs being notoriously unstable).

A call for new maintainers had been making the rounds on Twitter.

1 Like

I found when using google for geocoding, that it would often fail. Putting a 1-2 second time delay between requests seemed to help. But it did seem quite twitchy to me.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.