Tag: 轨道 地理编码器

Geocoder gem是否可以使用谷歌API密钥?

我正在为我的项目使用ruby geocoder gem,随着项目的不断发展,我开始考虑连接到Google API密钥。 将此添加到项目后: Geocoder.configure do |config| # geocoding service (see below for supported options): config.lookup = :google # to use an API key: config.api_key = ‘my_key’ # geocoding service request timeout, in seconds (default 3): config.timeout = 5 end 我收到Google Geocoding API错误:请求被拒绝。 当我启动应用程序时。 从阅读开始,如果他们选择继续使用gem,似乎其他人切换到雅虎。 我可以将gem配置为使用google api密钥吗? 主要是,我想留意每日查询的数量,以避免超过限制。

Ruby Geocoder附近很慢

使用Rails 3.2,Ruby 1.9,geocoder gem。 我的控制器中有以下查询: # 1500+ms to load nearby_shops = (current_shop.nearbys(10, :order => ‘overall_rating DESC’) .where(:shop_type => shop_type).includes(:photos, :active_property_list => :hotel_image_lists).limit(5)) # SQL Shop Load (4045.6ms) SELECT shops.*, 3958.755864232 * 2 * ASIN(SQRT(POWER( SIN((36.111927 – shops.lat) * PI() / 180 / 2), 2) + COS(36.111927 * PI() / 180) * COS(shops.lat * PI() / […]

request.location ruby​​ geocoder中的错误

在我的sesions表中我使用请求方法存储国家和城市名称,现在,在ubuntu服务器中它运行良好但在redhat中我收到此错误 NoMethodError (undefined method `city’ for nil:NilClass) 我尝试了这个问题的解决方案 ,我重新启动了我的服务器,但它对我不起作用。 在两台服务器中,我使用的是Passenger + Apache