简体   繁体   English

谷歌地图反向编码 API 突然开始失败

[英]Google Maps Reverse Coding API suddenly starts failing

In my react native app I am using Google Reverse geoCoding API to get location names from lat-lng.在我的 React 本机应用程序中,我使用 Google Reverse geoCoding API 从 lat-lng 获取位置名称。 It was working fine for months, and it suddenly starts failing now.几个月来它工作正常,现在突然开始失败。

The query that i was using:我正在使用的查询:

fetch("https://maps.googleapis.com/maps/api/geocode/json?address=" +
            this.state.region.latitude + "," +
            this.state.region.longitude +
            "&key=" + GOOGLE_API_KEY
    )
    .then(response => response.json())
    .then(responseJson => { ... })

I realized that i was using it wrong all these months as it should be .../json/latlng instead of .../json/address .我意识到我这几个月都在使用它,因为它应该是.../json/latlng而不是.../json/address So I corrected it now:所以我现在更正了它:

https://maps.googleapis.com/maps/api/geocode/json?latlng=....

as mentioned in the Offical Docs官方文档中所述

Still its not giving any results, despite saying status: 200仍然没有给出任何结果,尽管状态:200

Below is the response I am getting from this fetch call, it doesnt give any significant info of what could be wrong.下面是我从这个fetch调用中得到的响应,它没有提供任何可能出错的重要信息。

{
    "type": "default",
    "status": 200,
    "ok": true,
    "headers": {
        "map": {
            "content-type": "application/json; charset=UTF-8",
            "server-timing": "gfet4t7; dur=17",
            "pragma": "no-cache",
            "alt-svc": "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-27=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
            "cache-control": "no-cache, must-revalidate",
            "server": "mafe",
            "expires": "Fri, 01 Jan 1990 00:00:00 GMT",
            "access-control-allow-origin": "*",
            "x-xss-protection": "0",
            "content-encoding": "gzip",
            "date": "Sun, 20 Sep 2020 15:01:41 GMT",
            "content-length": "200",
            "vary": "Accept-Language",
            "x-frame-options": "SAMEORIGIN"
        }
    },
    "url": "https://maps.googleapis.com/maps/api/geocode/json?latlng=12.991999943565116,77.72999983280897&key=XXXXXXXXXX",  // Instead of XXX there was correct key
    "bodyUsed": false,
    "_bodyInit": {
        "_data": {
            "size": 256,
            "offset": 0,
            "blobId": "2728F9A1-2861-4EDB-A9B7-1500F3F5205C",
            "type": "application/json",
            "name": "json",
            "__collector": {}
        }
    },
    "_bodyBlob": {
        "_data": {
            "size": 256,
            "offset": 0,
            "blobId": "2728F9A1-2861-4EDB-A9B7-1500F3F5205C",
            "type": "application/json",
            "name": "json",
            "__collector": {}
        }
    }
}

I tried giving multiple different lat lng pairs (which were working earlier), but it doesnt work anymore.我尝试提供多个不同的 lat lng 对(它们在早期工作),但它不再工作了。

I have a valid Google Maps Billing Account with a few hundred USD already in the credit.我有一个有效的 Google 地图结算帐户,信用额度中已有几百美元。 So it's not the billing issue as well.所以这也不是计费问题。


UPDATE更新

When I put this query in browser (as suggested by @geocodezip in comment) it gives a billing related error response:当我将此查询放入浏览器时(正如@geocodezip 在评论中所建议的那样),它给出了与计费相关的错误响应:

{
   "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"
}

Although the billing is already enabled.虽然计费已经启用。 I am now talking to the Google Cloud Support, to get it resolved.我现在正在与 Google Cloud 支持人员交谈,以解决问题。

I talked to the Google Support and they told me that it could be because the registered billing account (for Google Cloud Platform) was in INR and its no longer compatible with Google Maps Platform Due to India migration.我与 Google 支持部门进行了交谈,他们告诉我这可能是因为注册的结算帐户(用于 Google Cloud Platform)使用的是 INR,并且由于印度迁移,它不再与 Google Maps Platform 兼容。

https://developers.google.com/maps/gmp-india-faq#bill-why https://developers.google.com/maps/gmp-india-faq#bill-why

And I have to change my (Google Cloud) project billing account from INR to a USD billing account.而且我必须将我的 (Google Cloud) 项目结算账户从 INR 更改为 USD 结算账户。 Despite my Google Maps billing account already in USD.尽管我的 Google 地图计费帐户已经以美元计价。

(Yes they are different. Google Maps billing acc & Google Cloud Billing acc) (是的,它们是不同的。Google Maps billing acc 和 Google Cloud Billing acc)

Without any warning email, Google Maps suspended the maps API service abruptly !!在没有任何警告 email 的情况下,谷歌地图突然暂停了地图 API 的服务!!

People using maps apis in their production app, please take care.在他们的生产应用程序中使用地图 api 的人,请小心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM