【问题标题】:Google Geocoding is only running without API KeyGoogle 地理编码仅在没有 API 密钥的情况下运行
【发布时间】:2015-02-18 03:15:02
【问题描述】:

我正在使用该代码运行地理编码,效果很好: $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' 。 $地址。 '&sensor=false';

问题是,它只运行几个地址(大约 200 个)然后停止,所以我必须等待 24 小时才能再次开始地理编码。

所以我创建了一个 API 密钥来每天对 2500 个地址进行地理编码,并像这样添加它: $url = http://maps.googleapis.com/maps/api/geocode/json?&address= 。 $地址。 &sensor=false&key=MY_API_KEY;

现在的问题是,什么都没有发生。没有地址被地理编码。只有在没有 API 密钥的情况下,它才适用于少数地址。我还尝试了不同的键,有一个特定的推荐人,没有和推荐人 - 没有任何变化。不仅有一个地址被地理编码。

感谢帮助!

【问题讨论】:

    标签: javascript json google-maps api-key


    【解决方案1】:

    查看使用密钥调用 API 时返回的错误消息:

    http://maps.googleapis.com/maps/api/geocode/json?&address=New%20York,NY&sensor=false&key=my_api_key

    {
       "error_message" : "Requests to this API must be over SSL.",
       "results" : [],
       "status" : "REQUEST_DENIED"
    }
    

    您需要使用 https: 协议。

    https://maps.googleapis.com/maps/api/geocode/json?&address=New%20York,NY&sensor=false&key=my_api_key

    {
       "error_message" : "The provided API key is invalid.",
       "results" : [],
       "status" : "REQUEST_DENIED"
    }
    

    【讨论】:

    • 如果这解决了您的问题,请accept it
    猜你喜欢
    • 2016-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多