在生产服务器上使用地理编码器

发布于 2024-11-16 22:21:11 字数 523 浏览 0 评论 0原文

我正在开发一个基于位置的应用程序。我需要一个可靠的来源来获取地理定位。

现在我正在使用这个 geocoder 插件。

我收到此错误:-

Geocoding API not responding fast enough (see Geocoder::Configuration.timeout to set limit).

当我们的 5 人团队在临时服务器上进行测试时,我收到错误

我需要一个足够快的解决方案,每天大约 10k 请求,没有每秒限制

PS:我愿意使用一些付费服务。

编辑

想象一下您想要在纽约搜索某些内容的情况。在文本框中输入 newyork 并按 Enter 键。现在在服务器端,我需要获取纽约的地理编码,然后根据该信息在数据库中进行搜索。

I am developing a location based application. And i need a trustable source for getting geolocation.

right now i am using this geocoder plugin.

and i am getting this error:-

Geocoding API not responding fast enough (see Geocoder::Configuration.timeout to set limit).

I am getting error when our team of 5 is testing on staging servers

I need a fast enough solution with some ~10k request a day with no per second limits

PS: I am open to use some paid service.

EDIT

Think of a case you want to search something in NewYork. In textbox you will type newyork and press enter. Now on server side I need to fetch geocode for newyork and then search in db based upon that.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

脱离于你 2024-11-23 22:21:11

您应该对客户端进行地理编码(在 JavaScript 中),这样您就不会受到限制:

服务器端地理编码,通过
地理编码 Web 服务的配额为
每个 IP 每天有 2,500 个请求,所以
一天内的请求计入
配额。此外,Web 服务是
速率受限,因此要求
来得太快导致
阻塞。客户端地理编码
通过浏览器的速度受到限制
每个地图会话,因此地理编码是
分布在您的所有用户中,并且
随着您的用户群的扩展。地理编码
配额和速率限制推动
本文概述的策略。

何时使用客户端地理编码

基本答案是“几乎总是”。作为
地理编码限制是针对每个 IP 地址的,
该限制对消费者不利
您的申请。将会是
很少有人会去
每天输入超过 2,500 个地址
坐在他们的电脑前。所以,
运行客户端地理编码,您
一般不用担心
您的配额。

http://code.google.com/apis/maps/articles/geocodestrat.html

You should geocode client side (in javascript) you won't be hit by the limits :

Server-side geocoding, through the
Geocoding Web Service has a quota of
2,500 requests per IP per day, so all
requests in one day count against the
quota. In addition, the Web Service is
rate-limited, so that requests that
come in too quickly result in
blocking. Client-side geocoding
through the browser is rate limited
per map session, so the geocoding is
distributed across all your users and
scales with your userbase. Geocoding
quotas and rate limits drive the
strategies outlined in this article.

When to Use Client-Side Geocoding

The basic answer is "almost always". As
geocoding limits are per IP address,
that limit counts against the consumer
of your application. It's going to be
very rare that someone is going to
enter more than 2,500 addresses a day
sitting at their computer. Therefore,
running client-side geocoding, you
generally don't have to worry about
your quota.

http://code.google.com/apis/maps/articles/geocodestrat.html

度的依靠╰つ 2024-11-23 22:21:11

任何基于网络的服务都可能会发生这种情况。您可能需要考虑将这些任务发送到后台作业管理器(例如 Resque 或 Delayed Job),该管理器将重试失败的作业,而不会中断用户。它们还使您的应用程序看起来更快,因为您的用户不必等待第三方(可能是间歇性的)Web 应用程序响应。

This is probably bound to happen with any web based service. You might want to consider sending these tasks to a background job manager (such as Resque or Delayed Job) which will retry failed jobs without disrupting users. They also make your application seem faster since your user will not have to wait for third party (and possibly intermittent) web applications to respond.

尝试使用 maxmind.com - 这将根据 IP 地址进行地理查找。他们有一个免费或付费的数据库,您可以将其存储在您的服务器上。他们有一个 Ruby API。我在生产系统中使用它,并且当数据被缓存时,查找通常是亚毫秒级的。

Try using maxmind.com - this will do a geo lookup based on IP address. They have a free or paid for database that your store on your server. They have a Ruby API. I use this in a production system and the lookups are typically sub-millisecond as the data is cached.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文