Setting up Rails Geocoder with Personal API Key

不羁的心 提交于 2019-12-12 02:53:45

问题


Rails Geocoder says not to use Key for Free version, to instead only use the key for Premier. The site i'm maintaining seems to be going over the limit not, so I set up a new api key and enabled billing.

I setup my initilizer like so

     Geocoder.configure(
    :timeout  => 5,
    :lookup   => :google,
    :api_key  => "ENTERED MY KEY HERE",
    :units    => :mi
    )

I Get a REQUEST DENIED in my logs. When I delete the file it uses geocoders default config and works. But my the morning it will stop working, assuming I'm going over the limit. Rather than setting up a Premier account, I enabled billing assuming we would just be charged the difference. I think I read $.50 per 1000 requests. Any Ideas?


回答1:


Cache your geocoding requests, it will save you some bucks (hopefully) and speed up your app (for sure).

Geocoder.configure(
  # ...
  :cache => Redis.current
)



回答2:


I sadly went with Microsoft's Bing service.



来源:https://stackoverflow.com/questions/18524165/setting-up-rails-geocoder-with-personal-api-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!