I'm talking specifically about the quota of type elements per minute per user. I set this value to 150. The documentation says number of elements is origins x destinations.
This is how I call the api:
const distanceMatrixService = new google.maps.DistanceMatrixService();
const request = {
origins: [locator.searchLocation.location],
destinations: locator.locations.map(function (x) {
return x.coords;
}),
travelMode: google.maps.TravelMode.DRIVING,
unitSystem: units,
};
distanceMatrixService.getDistanceMatrix(request, distancesReceivedCallback);
I get a proper response having 1 origin and locator.locations
contains 3 destinations. As far as I add a 4th destination I receive an error response:
{
"destination_addresses" : [],
"error_message" : "Distance Matrix Service: You have exceeded your rate-limit for this API.",
"origin_addresses" : [],
"rows" : [],
"status" : "OVER_QUERY_LIMIT"
}
The other quotas are all set to a very high value so they should not be a problem.
Why am I exceeding the quota of 150 with 4 destinations but not with 3?
From the documentation my requests should count as 4 (1 x 4) elements. The only way the api works reliable is when I set this specific quota to unlimited which is not desireable for my use case.