Google Javascript API地理编码限制 [英] Google Javascript API Geocoding Limits

查看:128
本文介绍了Google Javascript API地理编码限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Google Maps JavaScript API v3进行客户端地理编码的限制是什么?






我的研究:


  1. Google地图PHP API每天限制2500个地理编码请求( https://developers.google.com/maps/documentation/geocoding/#Limits

  2. Google Maps Javascript API v3每天限制25000次地图加载次数 https: //developers.google.com/maps/documentation/javascript/usage

  3. Google建议使用JavaScript API进行地理编码,以避免PHP API受到2500限制。它表示运行客户端地理编码,你通常不必担心你的配额( https://developers.google.com/maps/articles/geocodestrat#client

但是,无处它在任何文档中声明了通过Google Maps JavaScript API v.3获得的地理编码限制。
$ b (这一直困扰着我一段时间,我已经在不止一次的情况下进行了研究,但未能找到明确的答案)

Google地图商业支持。以下是我个人的观点,不是Google的,但我们只是说我对这个主题非常熟悉!

首先,区分 客户端地理编码 (JavaScript调用google.maps.Geocoder)和 服务器端地理编码 (HTTP请求至/地图/ API /地理编码)。这个问题和答案是关于客户端地理编码的具体问题;有关服务器端限制的信息,请参阅此处。特别是,经常提到的每个IP每天2,500个请求限制仅适用于服务器端地理编码,而不适用于客户端。

所以,b
$ b

简短的答案是,没有专门针对客户端地理编码的文档查询限制。一旦客户端加载了Google Maps JavaScript API库,它可以根据需要制作尽可能多的地理编码请求,只要它们以完全的速度完成即可。两条经验法则确保您不会遇到问题:


  1. 根据用户交互启动地理编码,即使有短的请求突发(例如,点击一个按钮来对几个地址进行地理编码)。
  2. 捕获所有OVER_QUERY_LIMIT错误并正常处理它们(例如,指数退避)。 此处是Python中的一些示例代码。

但是请不要试图繁忙地循环地理编码器或者盯着它几个小时,以防止滥用。


$ b $ p UPDATE
$ b 截至2017年,客户端配额是根据相应的Web服务配额计算的。请看Christophe Roussy的回答。

What are the limits for client side geocoding with Google Maps JavaScript API v3?


My research:

  1. Google Maps PHP API has a limit of 2500 geocode requests per day (https://developers.google.com/maps/documentation/geocoding/#Limits)
  2. Google Maps Javascript API v3 has a limit of 25000 map loads per day (https://developers.google.com/maps/documentation/javascript/usage)
  3. Google suggests using javascript API for geoocoding to avoid the 2500 limit through the PHP API. It states "running client-side geocoding, you generally don't have to worry about your quota" (https://developers.google.com/maps/articles/geocodestrat#client)

However, nowhere does it state in any of the documentation what the geocoding limits are through the Google Maps JavaScript API v.3.

(This has been bothering me for a while, and I have researched it on more than one occasion and failed to find a solid answer)

解决方案

I work in Maps for Business support at Google. The following is my personal opinion, not Google's, but let's just say I'm rather familiar with this topic!

First, it's important to distinguish between client-side geocoding (JavaScript calls to google.maps.Geocoder) and server-side geocoding (HTTP requests to /maps/api/geocode). This question and answer are specifically about client-side geocoding; for server-side limits, see here. In particular, the oft-mentioned 2,500 requests per IP per day limit applies only to server-side geocoding, not client-side.

So the short answer is, there is no documented query limit specifically for client-side geocoding. Once a client has loaded the Google Maps JavaScript API library, it can make as many geocode requests as it likes, provided they're done at a sane speed. Two rules of thumb to ensure you don't run into problems:

  1. Initiate geocoding in response to user interaction, and you'll be fine even if there are short request bursts (eg. click a button to geocode several addresses).
  2. Catch any OVER_QUERY_LIMIT errors and handle them gracefully (eg. exponential backoff). Here is some sample code in Python.

But please do not try to busy-loop the geocoder or hammer away at it for hours on end, there are protections against abuse.

UPDATE

As of 2017 the client side quota is calculated against corresponding web service quota. Please have a look at Christophe Roussy's answer.

这篇关于Google Javascript API地理编码限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆