Ruby google 企业的地理编码器

Ruby Geocoder for google business

我正在为 ruby 使用地理编码器 gem。使用 google 地图 API 的 V2 for business,您可以在 API 的 V3 中的 config/initializers/geocoder.rb 中传递 API 键,他们不再给您 API 密钥,而不是 client-id,它基本上是用于为 url 创建签名的加密密钥。由于我无法获得 API 密钥,所以我不太知道如何进行后者。有人 运行 遇到过这个问题吗?如果可以的话,请指出 googles 文档以外的方向。

以下配置应该有效(替换为您自己的信息):

# -*- encoding : utf-8 -*-
Geocoder.configure do |config|
  config.lookup = :google_premier
  config.api_key = [ 'GOOGLE_CRYPTO_KEY', 'GOOGLE_CLIENT_ID', 'GOOGLE_CHANNEL' ]
  config.timeout = 10
  config.units = :km
end