在哪里放置Google地理编码API的API密钥?

Where to place API key for Google Geocoding API?

我们使用谷歌地理编码API将地址映射到经纬度。

这是用于编码(返回json)的URL示例-

http://maps.googleapis.com/maps/api/geocode/json?地址=达拉斯传感器=假

消息:超出查询限制

好吧,这是有道理的,因为我们每天超过2500个限制,所以我们把API密钥放在这里-

http://maps.googleapis.com/maps/api/geocode/json?key=xxxxx&address=dallas&sensor=false

消息:请求被拒绝

我想知道在哪里/如何放置API密钥。


在版本3中,您需要在URL中传递ClientID,而不是像在自由版本中那样传递key:https://developers.google.com/maps/articles/v2tov3 newkey

所以你的网址应该是:http://maps.googleapis.com/maps/api/geocode/json?客户机=XXXXX&address=达拉斯&sensor=假

没有足够的幸运拥有一个付费帐户,所以我无法测试-但我认为这将使你走上正确的道路。

相关链接:https://developers.google.com/maps/documentation/business/webservices/

Client ID

You must include your client ID in all API requests. Your client ID
identifies you as a Maps API for Business customer and enables support
and purchased quota for your application. Requests made without a
client ID are not eligible for Maps API for Business benefits.

If you're switching from the free API services to a Maps API for
Business implementation, you must remove the key parameter from your
requests. Google Maps API web services will deny requests made with
both a client ID and a key.

More information is available in the Authentication and Authorization
chapter of this guide.

If you have lost your client ID, you can recover it by logging in to
the support portal and clicking Maps: Add URLs from the links on the
left of the page.

编辑

有关更多信息,包括将客户端ID传递到EarthAPI、V2 API和MapsAPI for Flash的说明,请阅读加载客户端API。

如果您丢失了客户机ID或加密密钥,您可以通过登录到支持门户并单击"映射:从页面左侧的链接添加URL"来恢复它们。