【问题标题】:unable to get the routes from the google api无法从 google api 获取路线
【发布时间】:2015-10-13 05:38:50
【问题描述】:

我按照通常的步骤获得了 api 密钥。 然后我能够得到地图并在上面使用一些内置的东西,比如搜索等 后来我尝试路由,我无法获得路由。当我粘贴请求时:

https://maps.googleapis.com/maps/api/directions/json?origin=28.6100,2077.2300&destination=18.9750,72.8258&key=mykey

在浏览器上,我得到以下信息,并意识到我没有权限。我搜索了这个问题,但找不到解决方案,请帮助。 浏览器响应:

{
   "error_message" : "This IP, site or mobile application is not authorized     to use this API key. Request received from IP address xxxxxxxx, with empty     referer",
  "routes" : [],
  "status" : "REQUEST_DENIED"
}

【问题讨论】:

  • 你可以从stackoverflow.com/questions/32995197/…得到,如果遇到任何问题,请告诉我结果
  • 这不是我的问题的解决方案,您在路由时没有获取多个坐标
  • 好的,你可以通过步进方式在 1 到 2 和 2 到 3 和 3 到 4 之间画根

标签: android api google-maps


【解决方案1】:
  1. 确保您使用的是服务器 API 密钥,而不是 Android 密钥(移动开发)。看这篇文章:

    Google Places API request denied for Android autocomplete, even with the right api key.

  2. 还要确保将密钥发送到 GooglePlaces 实例。

  3. 如果您通过 IP 限制 API 密钥的使用,请确保您的请求来自允许的地址。

【讨论】:

  • 我确定我使用的是android key,还有其他想法吗??
  • 如果您使用的是 android 密钥,请确保您错误地使用了服务器 API 密钥。
猜你喜欢
  • 2013-02-25
  • 2013-03-05
  • 2012-02-03
  • 2020-02-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多