Exceeding Query Limit on Google Maps API Version 3

My application retrieves addresses from a file that is updated every few hours, geocodes them, and displays them on Google Maps.

Despite implementing a 2-second delay between each query and not using the application since the previous day, I am encountering an OVER_QUERY_LIMIT error. The code below is executed when the corresponding function is called, which occurs 2 seconds after its previous invocation.

var xmlhttp
var status;

if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp = new XMLHttpRequest();
}
else{// code for IE6, IE5
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

var lAddress = tAddress.replace(/ /g, " +");


xmlhttp.open("GET","http://maps.googleapis.com/maps/api/geocode/json?address=" + lAddress +"&sensor=false", false);

xmlhttp.onreadystatechange = function(){
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200){

        var result = JSON.parse(xmlhttp.responseText);

        status = result.status;


        if(status == google.maps.GeocoderStatus.OK){
            precise[index].found = 1;
            precise[index].lat= result.results[0].geometry.location.lat;
            precise[index].lng = result.results[0].geometry.location.lng;
            precise[index].addr = tAddress;

        }
        else if(status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT){
            alert("The search limit has been exceeded. Please try again tomorrow.");
        }
    }
}


xmlhttp.send();

Answer №1

Researching the details of google maps documentation reveals that

If you go beyond the specified limits, you will receive an OVER_QUERY_LIMIT status code in response.

This indicates that the web service will cease to provide regular responses and will only return the status code OVER_QUERY_LIMIT until further usage is permitted. This situation may occur:

  1. Almost immediately, if the error occurred due to your application sending an excessive number of requests per second.
  2. At some point within the next 24 hours if the error occurred because your application exceeded the daily request limit. The exact time at which the daily quota is reset varies for different customers and APIs and may change over time.

When you receive a response with the status code OVER_QUERY_LIMIT, it is important for your application to identify which limit has been surpassed. To do this, pause for 2 seconds and resend the same request. If the status code remains OVER_QUERY_LIMIT, it means your application is sending too many requests per day. Otherwise, it indicates an excess of requests per second.

Based on the information provided, it is likely that you have reached your daily limit.

According to their licensing policy, you are allowed up to 2500 requests for geocoding.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The method WebKitBrowser.StringByEvaluatingJavaScriptFromString does not provide any output

After running all JavaScript, I need to retrieve the HTML content. However, I am facing an issue using WebKit.NET where the method WebKitBrowser.StringByEvaluatingJavaScriptFromString does not return anything, even with a simple alert(). When I try passi ...

Using Regular Expression in JavaScript to replace variables within a string

Looking for assistance to replace keywords in a string with pre-defined variables. Currently, the code only displays variable names instead of their content. Can anyone provide help? Desired Output: 1111Test1 2222Test2 3333Test3 Current Output ...

Is the AngularJS Date property model sending an incorrect value to the server?

There are some puzzling things I am trying to figure out. When using datetimepicker, the Date and time selected appear correctly on the screenshot. The value in the textbox is accurate The model's value in console is correct (but hold on a second... ...

Executing JavaScript - Triggering an 'onClick' event within a For loop to dynamically load multiple hyperlinks

I am currently working on creating a listview using JSON data. However, when I call an 'onclick' function from a For loop, the link opens in a new window and loads three URLs into the browser's URL input. Is there a way to modify the code be ...

Exploring PHP cURL with the power of jQuery

function php_download($Url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $Url); curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm"); curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); curl_setopt($ch, CURLOPT_H ...

The TouchableOpacity function is triggered every time I press on the Textinput

Every time I press on a text input field, the login function is called This is the touchable statement: <TouchableOpacity style={InputFieldStyle.submitButton} onPress={this.login(this.state.email, this.state.password)}> <Text ...

Step by step guide on rotating a plane with texture by 90 degrees

I've been working on developing an fps game, but I'm encountering an issue where the floor disappears from the scene when I try to rotate it close to 90 degrees. Here's the code snippet responsible for creating the plane. var colorMap = new ...

Drop the <span> element into a paragraph by utilizing JQuery's drag and drop feature

Trying to drag and drop <span> into <p>. The code is functional, but encountering 3 issues: When editing content inside <p> by typing (e.g. three words) and then dragging <span> into <p>, the newly typed words are consider ...

Using JQuery to test for element visibility in Jest tests

I am currently facing an issue in my unit test where the visibility state of an element does not change as expected. I am using .is(":visible") to verify this, and while it works fine in browsers, the unit test always reports that the element is hidden. B ...

Django and its compatibility with modal windows

I have developed a Django website that includes multiple items in a "for" loop. I need to delete a specific item by opening a modal window and passing the post ID (referred to as "get_post_id") to the modal window. However, I want the modal window to exist ...

How can I use jQuery to access the parent node in an XML document?

I have been trying to extract the top-level 'label' attribute from the XML code below using jQuery, but I haven't had any luck so far. I have already converted it into a DOM object, but the results are not what I expected. Does anyone have a ...

Tips for Angular4: ensuring ngOnDestroy completion before navigation

My task involves managing a list of objects where the user can choose an object to edit using a child component. However, when the user returns to the list component, the child component needs to clean up in the ngOnDestroy method, which includes making a ...

Difficulty encountered while deploying a React application on Netlify

I followed the instructions on a Medium link to deploy my React application on Netlify: To set up the production mode, I utilized an express server for defining build scripts. After creating the build scripts on my local machine, I uploaded them to the Ne ...

Switch between two fields using just one animation

I've been experimenting with creating an information tag that slides out from behind a circular picture. To achieve this effect, I created a block and circle to serve as the information field placed behind the image. However, I'm facing a challe ...

Leveraging React hooks to combine an array and an object within an array

Struggling to incorporate an array and an object into another array. This is the setup in my constructor: const [dashboard, setDashboard] = useState({ loading: true, data: [], address: '' }) This is how I envision the final data structure: { ...

Having trouble getting DeviceOrientationControls to function properly

For the past week, I've been attempting to use my smartphone's orientation controls to manipulate my three.js scene. Although I lost the tutorial that originally guided me, I managed to find the example I saved from it. However, despite studying ...

Issue with large date changes causing MUI DatePicker to freeze

The MUI DatePicker, whether from Labs or X, was functioning perfectly. However, I am now facing an issue where it hangs when trying to change the date by ten years. It appears that the code gets stuck in an endless loop, yet there are no errors displayed i ...

Ways to automatically close the external window upon logging out in Angular 12

I have successfully created an external window in my Angular application. Everything is working as expected, but I am facing an issue when trying to automatically close the external window upon user logout. Although I have written the code below and it wo ...

Can Cesium "separate" intersecting polylines?

Currently, I am utilizing Cesium and aiming to visually display multiple polylines between two entities. Specifically, I want a green polyline from entity A to entity B, as well as a blue polyline from entity A to entity B. My intention is for these lines ...

How to automatically redirect empty routes to a specific route in Next.js

When visiting a non-existent endpoint in Next.js, I receive a 404 error. What I actually want is for all unused routes to automatically redirect to a default route; specifically, the landing page. I've spent more than an hour trying to figure this ou ...