Javascript 超过查询限制Google地理编码API v3 AJAX

Javascript 超过查询限制Google地理编码API v3 AJAX,javascript,ajax,google-maps-api-3,google-geocoding-api,Javascript,Ajax,Google Maps Api 3,Google Geocoding Api,我的应用程序从一个每隔几个小时更新一次的文件中获取地址,并对其进行地理编码,然后将其放在谷歌地图上 即使应用程序已经几天没有使用,现在仍会返回Over_query_limit 有些天它成功地进行了地理编码,而有些天它甚至在未达到限制的情况下返回超过限制 如果在地理代码上达到超过查询限制,我将在查询上延迟3秒。然后,它使用相同的地址重新运行代码以再次对其进行地理编码 var xmlhttp var status; if (window.XMLHttpRequest){// code for IE

我的应用程序从一个每隔几个小时更新一次的文件中获取地址,并对其进行地理编码,然后将其放在谷歌地图上

即使应用程序已经几天没有使用,现在仍会返回Over_query_limit

有些天它成功地进行了地理编码,而有些天它甚至在未达到限制的情况下返回超过限制

如果在地理代码上达到超过查询限制,我将在查询上延迟3秒。然后,它使用相同的地址重新运行代码以再次对其进行地理编码

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();

事实上,如果你不使用付费的,谷歌使用地理编码是有限制的,所以我建议在location创建时使用地理编码获取lat longs,并将其保存到具有相关地址的数据库中,然后根据你的要求使用lat longs。或者你可以使用服务器端地理编码,这样与客户端相比,你将获得更多的限制,.

为什么要使用javascript提供的web服务?使用。