Google geocode api问题

问题描述 投票:0回答:1

我正在尝试使用Google地理编码api通过纬度和经度点(https://maps.googleapis.com/maps/api/geocode/json?latlng= {LATITUDE},{LONGITUDE}&key = {MY_API_KEY})来获取地址。我面临的问题是,此api仅给出几次正确的响应,可能是30次中的1次。其他时间在响应中出现一些随机错误,如下所示。

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

{
error_message: "You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started",
results: [ ],
status: "REQUEST_DENIED"
}

{
error_message: "This API project was not found. This API project may have been deleted or may not be authorized to use this API. You may need to enable the API under APIs in the console.",
results: [ ],
status: "REQUEST_DENIED"
}

下面有时还会显示我有时会得到的正确回答。

{
plus_code: {
compound_code: "CCJW+22 Rajkot, Bihar, India",
global_code: "7J9WCCJW+22"
},
results: [
{
address_components: [
{
long_name: "Axis Bank",
short_name: "Axis Bank",
types: [
"establishment",
"point_of_interest"
]
},
.
.
.
.
.
.

有人可以帮我解决此问题。谢谢。

google-geocoder google-geocoding-api
1个回答
0
投票
对于情况2:好吧,它是paid service。您不仅可以注册一个帐户并获取API密钥,还可以开始点击API并获得响应。首先,您必须通过输入enable billing在帐户上输入credit card details。如果不确定,则不用担心free request quota。完成后,只有您才能获得正在使用的API密钥。

对于最后一种情况:好吧,您必须先做一个项目。首先在其上输入make a projectenable billing,然后为其获取API key。好像您删除了启用了API和计费功能的项目,出现此错误。只需仔细遵循Google文档。

旁注:请始终记住限制您的按键。

© www.soinside.com 2019 - 2024. All rights reserved.