admin管理员组文章数量:1026689
My application gets addresses from a file that is updated every couple of hours and geocodes them and puts them on google maps.
I'm getting a OVER_QUERY_LIMIT status even though I have not used it since the day before and I'm putting time between each query. I'm putting 2 seconds between each query, this code is used when the function it is in is called which is called after 2 seconds after it's been called before.
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","=" + 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();
My application gets addresses from a file that is updated every couple of hours and geocodes them and puts them on google maps.
I'm getting a OVER_QUERY_LIMIT status even though I have not used it since the day before and I'm putting time between each query. I'm putting 2 seconds between each query, this code is used when the function it is in is called which is called after 2 seconds after it's been called before.
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./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();
Share
Improve this question
asked Mar 4, 2014 at 13:47
user1721803user1721803
1,1952 gold badges14 silver badges21 bronze badges
4
- You say the addresses are in a file that are updated every couple of hours - if you don't check which addresses are updated and you (re-)geocode all of them, this could push you over your limit. – ChrisW Commented Mar 4, 2014 at 14:24
- I dont geocode all of them. I get the address i need from the file based on a search criteria. – user1721803 Commented Mar 4, 2014 at 14:26
- Do you track how many you're geocoding? – ChrisW Commented Mar 4, 2014 at 14:44
- No but i'm the only one using it and no way in hell am i reaching 2500 queries. – user1721803 Commented Mar 4, 2014 at 14:54
1 Answer
Reset to default 3Reading documentation about google maps., you can see that
If you exceed the usage limits you will get an
OVER_QUERY_LIMIT
status code as a response.This means that the web service will stop providing normal responses and switch to returning only status code
OVER_QUERY_LIMIT
until more usage is allowed again. This can happen:
- Within a few seconds, if the error was received because your application sent too many requests per second.
- Some time in the next 24 hours, if the error was received because your application sent too many requests per day. The time of day at which the daily quota for a service is reset varies between customers and for each API, and can change over time.
Upon receiving a response with status code
OVER_QUERY_LIMIT
, your application should determine which usage limit has been exceeded. This can be done by pausing for 2 seconds and resending the same request. If status code is stillOVER_QUERY_LIMIT
, your application is sending too many requests per day. Otherwise, your application is sending too many requests per second.
Based on what you told most probably you already used your daily limit.
Based on their licensing policy you can get 2500 request for geocoding.
My application gets addresses from a file that is updated every couple of hours and geocodes them and puts them on google maps.
I'm getting a OVER_QUERY_LIMIT status even though I have not used it since the day before and I'm putting time between each query. I'm putting 2 seconds between each query, this code is used when the function it is in is called which is called after 2 seconds after it's been called before.
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","=" + 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();
My application gets addresses from a file that is updated every couple of hours and geocodes them and puts them on google maps.
I'm getting a OVER_QUERY_LIMIT status even though I have not used it since the day before and I'm putting time between each query. I'm putting 2 seconds between each query, this code is used when the function it is in is called which is called after 2 seconds after it's been called before.
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./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();
Share
Improve this question
asked Mar 4, 2014 at 13:47
user1721803user1721803
1,1952 gold badges14 silver badges21 bronze badges
4
- You say the addresses are in a file that are updated every couple of hours - if you don't check which addresses are updated and you (re-)geocode all of them, this could push you over your limit. – ChrisW Commented Mar 4, 2014 at 14:24
- I dont geocode all of them. I get the address i need from the file based on a search criteria. – user1721803 Commented Mar 4, 2014 at 14:26
- Do you track how many you're geocoding? – ChrisW Commented Mar 4, 2014 at 14:44
- No but i'm the only one using it and no way in hell am i reaching 2500 queries. – user1721803 Commented Mar 4, 2014 at 14:54
1 Answer
Reset to default 3Reading documentation about google maps., you can see that
If you exceed the usage limits you will get an
OVER_QUERY_LIMIT
status code as a response.This means that the web service will stop providing normal responses and switch to returning only status code
OVER_QUERY_LIMIT
until more usage is allowed again. This can happen:
- Within a few seconds, if the error was received because your application sent too many requests per second.
- Some time in the next 24 hours, if the error was received because your application sent too many requests per day. The time of day at which the daily quota for a service is reset varies between customers and for each API, and can change over time.
Upon receiving a response with status code
OVER_QUERY_LIMIT
, your application should determine which usage limit has been exceeded. This can be done by pausing for 2 seconds and resending the same request. If status code is stillOVER_QUERY_LIMIT
, your application is sending too many requests per day. Otherwise, your application is sending too many requests per second.
Based on what you told most probably you already used your daily limit.
Based on their licensing policy you can get 2500 request for geocoding.
本文标签: javascriptOVERQUERYLIMIT google maps api v3Stack Overflow
版权声明:本文标题:javascript - OVER_QUERY_LIMIT google maps api v3 - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745650824a2161308.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论