Google 地图地理编码查询限制 v2 和 v3 之间的差异
当我在 v2 中执行客户端地理编码请求时,我能够以 200 毫秒的间隔连续执行大量请求。但在 v3 中,我必须将间隔增加到 2 秒,以避免 OVER_QUERY_LIMIT 错误。这意味着在 Maps v3 中我的地理编码将会慢得多。
Maps API v2 和 v3 之间的这种差异对我来说真的很奇怪。有其他人也遇到过这个问题还是只有我遇到过这个问题?有没有办法在页面的其余部分使用 v3 的同时使用 v2 地理编码器?
PS。我最关心的是反向地理编码(latlng->address),它比正常的地理编码还要慢。
When I perform client side geocoding requests in v2, I'm able to do quite a lot of requests in a row with 200ms intervals. But in v3 I have to increase the interval to 2 seconds in order to avoid the OVER_QUERY_LIMIT error. This means in Maps v3 my geocoding will be much-much slower.
This kind of difference between Maps API v2 and v3 seems really strange to me. Has anyone else also experienced this problem or is it just me? Is there any way to use the v2 geocoder while the rest of the page uses v3?
PS. I'm mostly concerned with reverse geocoding (latlng->address), which is even slower than the normal geocoding.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在申请中所做的就是尽可能快地做尽可能多的事情。每当我达到 OVER_QUERY_LIMIT 时,我都会让我的线程休眠 5 秒,然后重试。这效果很好。我做了一些尝试来了解它可以处理多少个查询,似乎短时间内 10 个查询是极限。然后你需要稍等一下。
我认为不可能同时使用这两个 API,因为您必须包含两个 .js 文件,并且肯定会有一些具有相同名称的内容,这会导致您无法真正预测的行为。
但我可以说的一件事是,如果您必须在客户端完成所有操作,那么您似乎做错了什么。您是否可以选择将位置存储在数据库或其他内容中,然后仅在有新内容出现时才进行查找?
What I did in my application was doing as many as I could as fast as I could. Whenever I hit the OVER_QUERY_LIMIT I would let my thread sleep for 5 seconds and then try again. This worked great. I did some tries to find out how many it could handle and it seems that 10 queries in a short time is the limit. Then you have to wait a bit.
I don't think it is possible to use both API's since you would have to include both .js files, and there are bound to be some things that have the same name and that would result in behavior you can't really predict.
One thing I can say though is that it seems you are doing something wrong if you have to do it all client-side. Is it not an option for you to store the locations in a database or something and then only make the lookups whenever something new comes?