2

我已经尝试了几个小时让地理编码器与谷歌一起工作。我或多或少想弄清楚如何配置我的谷歌帐户和下面的代码以使地理编码器工作

Geokit::Geocoders::GoogleGeocoder.client_id = ''
Geokit::Geocoders::GoogleGeocoder.cryptographic_key = ''

对于我尝试过的各种参数,我从谷歌得到以下回复。

Unable to authenticate the request. Provided 'signature' is not valid for the provided
client ID. Learn more:
https://developers.google.com/maps/documentation/business/webservices/auth

在 Google Developer 面板上,有以下选项: 1. 默认情况下,Compute Engine 和 App Engine 会提供 Client ID 和 Email Address 字段。我启用了以下 API:BigQuery、Geocoding、Google Cloud SQL、Google Cloud Storage、Google Storage JSON API、Google Maps API v3、Google Maps Coordinate API、Google Maps Geolocation API

当您单击创建新的客户端 ID 时,您会看到三个选项:Web 应用程序、服务帐户和已安装的应用程序。我已经尝试过 Web 应用程序和安装的应用程序,它们都提供了一个名为“Client Secret”的字段,我将其输入到变量“cryptographic_key”中。它还提供了我在“client_id”字段中使用的客户端 ID。最后一个选项,服务,下载一个里面有私钥的证书。我不知道如何处理它,也无法提取私钥。

对此的任何帮助都会很棒。

4

2 回答 2

1

我想你想要: Geokit::Geocoders::GoogleGeocoder.api_key = 'myApiKey'

这是您用于免费服务的密钥,如果您使用的是付费的“Maps API for Business”,那么这两个参数是正确的。

这在当前的 README 中。可能是文档不够清楚?

于 2014-06-24T11:54:15.020 回答
0

你去过https://developers.google.com/maps/documentation/business/webservices/auth

这几乎总结了您需要什么以及从哪里获得它。

于 2014-05-29T14:52:21.800 回答