Google Javascript API地理编码限制 [英] Google Javascript API Geocoding Limits
问题描述
使用Google Maps JavaScript API v3进行客户端地理编码的限制是什么?
我的研究:
- Google地图PHP API每天限制2500个地理编码请求( https://developers.google.com/maps/documentation/geocoding/#Limits )
- Google Maps Javascript API v3每天限制25000次地图加载次数( https: //developers.google.com/maps/documentation/javascript/usage )
- Google建议使用JavaScript API进行地理编码,以避免PHP API受到2500限制。它表示运行客户端地理编码,你通常不必担心你的配额( https://developers.google.com/maps/articles/geocodestrat#client )
但是,无处它在任何文档中声明了通过Google Maps JavaScript API v.3获得的地理编码限制。
$ b (这一直困扰着我一段时间,我已经在不止一次的情况下进行了研究,但未能找到明确的答案)
$ b
简短的答案是,没有专门针对客户端地理编码的文档查询限制。一旦客户端加载了Google Maps JavaScript API库,它可以根据需要制作尽可能多的地理编码请求,只要它们以完全的速度完成即可。两条经验法则确保您不会遇到问题:
- 根据用户交互启动地理编码,即使有短的请求突发(例如,点击一个按钮来对几个地址进行地理编码)。
- 捕获所有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:
- Google Maps PHP API has a limit of 2500 geocode requests per day (https://developers.google.com/maps/documentation/geocoding/#Limits)
- Google Maps Javascript API v3 has a limit of 25000 map loads per day (https://developers.google.com/maps/documentation/javascript/usage)
- 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:
- 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).
- 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屋!