小编Col*_*art的帖子

谷歌地图api,提供的API密钥无效

这是我第一次发布关于堆栈溢出的问题,真的希望你们能帮忙。

我第一次尝试使用谷歌地图地理编码 api 并且无法让它工作。

我使用的网址格式是:

https://maps.googleapis.com/maps/api/geocode/json?address=LS2+9AQ&sensor=false&key=[MY_API_KEY]

在这种情况下,我正在从 chrome 浏览器查找英国邮政编码:LS2 9AQ。

当我不使用我的 api 密钥时,该 url 确实有效,但是没有密钥的允许调用数量的限制对于我的需要来说太低了。

我还没有在生产站点中使用它,现在它是从我的本地开发人员在 chrome 中运行的。

我得到的实际回应是:

[error_message] => The provided API key is invalid.
[results] => Array
    (
    )

    [status] => REQUEST_DENIED
Run Code Online (Sandbox Code Playgroud)

当我删除 api 密钥时,它会工作并返回以下内容:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "LS2 9AQ",
               "short_name" : "LS2 9AQ",
               "types" : [ "postal_code" ]
            },
            {
               "long_name" : "Woodhouse",
               "short_name" : "Woodhouse",
               "types" : [ "sublocality", "political" ]
            },
            {
               "long_name" : "Leeds",
               "short_name" …
Run Code Online (Sandbox Code Playgroud)

url google-maps geocoding

6
推荐指数
1
解决办法
9744
查看次数

标签 统计

geocoding ×1

google-maps ×1

url ×1