-1

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();
user1721803
  • 1,125
  • 2
  • 14
  • 21
  • Why are you using the web service from javascript? Use the [Google Maps Javascript API v3 geocoding service](https://developers.google.com/maps/documentation/javascript/geocoding). – geocodezip May 01 '14 at 18:34

1 Answers1

0

Actually google has its limit to use geocoding if you are not using paid one so i'll suggest get lat longs using geocoding when location creates save it to database with relavant address and use that lat longs as per your requirment.Or you can use server side geocoding so you will get some more limits compared to client side , check this.

Wit Wikky
  • 1,542
  • 1
  • 14
  • 28