My application gets addresses from a file that is updated every couple of hours and geocodes them and puts them on google maps.
Over_query_limit is now being returned even when the application has not been used in days.
Some days it geocodes successfully and others it return over_query_limit even when the limit has not been reached.
I'm putting a 3 second delay on a query if over_query_limit is reached on that geocode. It then reruns the code with the same address to geocode it again.
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("Search limit reached. Please try again tomorrow.");
}
}
}
xmlhttp.send();