需要45+点添加到谷歌地图 [英] Need to add 45+ points to a google map
问题描述
试图添加45个不同的点地图,但我只是得到 OVER_QUERY_LIMIT
回来,没有地图。
我通过一个字符串搜索得到的位置,然后指派返回经纬度对象到一个新的谷歌标记物
的字符串搜索的
VAR地理codeR =新google.maps.Geo codeR();
地理coder.geo code({'地址':X},功能(结果状态){
如果(状态=== google.maps.Geo coderStatus.OK){
VAR的结果=结果[0] .geometry.location;
返回结果; }其他{
警报(地理code不成功,原因如下:+状态);
}
});
谷歌地理编码是速率的限制,全天。它也通过IP地址限制。因此,两种可能的相互作用:如果你有很多其他人共享一个IP地址,它们也可能拖累自己的配额。这是在移动环境中尤其如此。另一种更可行的是,你正在运行到速率限制在一天。如果你得到,一两秒钟的停顿,然后再试一次。
您也可以缓存地理codeS和性能的目的地址,并使用谷歌的Web服务有一个备份服务器端地理编码服务。那会也可以quota'd但它是一个很好的后备方案。
trying to add 45 different points to a map, but I just get OVER_QUERY_LIMIT
returned, and no map.
I am getting locations via a string search, then assigning the returned LatLng object to a new google Marker object
String Search
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': x}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
var result = results[0].geometry.location;
return result;
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
Google Geocoding is rate limited throughout the day. It's also limited by IP address. So, two possible interactions: If you're sharing an IP address with lots of other people, they may also be dragging down your quota. This is particularly true in mobile environments. Another more likely possibility is that you are running into the rate limit over the day. If you get that, pause of a second or two and try again.
You can also cache geocodes and addresses for performance purposes, and have a back-up server side geocoding service using Google's web services. That'll also be quota'd but it's a good fallback.
这篇关于需要45+点添加到谷歌地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!