javascript - 谷歌地图中的 "You have exceeded your request quota for this API"

标签 javascript reactjs google-maps google-maps-api-3

我目前正在使用 react-google-map 让 Google map 在我的 React 项目中运行,这是我的 map 组件:

import React from 'react'
import { compose, withProps, lifecycle } from 'recompose'
import { withScriptjs, withGoogleMap, GoogleMap } from 'react-google-maps'

import MapStyle from  '../../../api/mapStyle'

const Map = ({ children }) => {

  return (

    <GoogleMap
      defaultZoom={15}
      defaultCenter={{ lat: 35.6840299, lng: 51.3861187 }}
    >
      {children}
    </GoogleMap>
  )
}

export default compose(
  withProps({
    googleMapURL: "https://maps.googleapis.com/maps/api/js?key=MY_KEY_HERE",
    loadingElement: <div style={{ height: `100%` }} />,
    containerElement: <div className='map' style={{ height: `100vh` }} />,
    mapElement: <div style={{ height: `100%` }} />
  }),
  withScriptjs,
  withGoogleMap,
)(Map)

如您所见,这与 react-google-map DOC 所说的一样,这里没什么特别的!

昨天我刚开始构建 map ,和往常一样,我去我的谷歌控制台拿到了一个 key ,然后我把它放在链接的 MY_KEY_HERE 部分,直到今天早上它都运行良好,今天我正在努力:

You have exceeded your request quota for this API

不是:

You have exceeded your daily request quota for this API

如下:

enter image description here

我搜索了 Google,我找到了 thisthisthis和许多其他人,但我找不到这个问题的任何正确答案。

我尝试了什么?

  1. 我在我的控制台中创建了几个其他的键来解决这个问题,但没有解决,我得到了同样的你已经超过了你的这个 API 的请求配额错误
  2. 我在 Google 上使用了我的另一个帐户来解决这个问题,我刚刚登录并转到控制台平台并再次生成了一个 key ,但我仍然收到该错误消息?
  3. 即使在 codeSandBox.io 中尝试,我仍然遇到同样的错误

我真的很困惑这个问题,我该如何解决?

最佳答案

编辑:下面的链接似乎已经失效。您可以在此处阅读 Google Maps Platform Billing 的文档 https://developers.google.com/maps/billing-and-pricing/billing#billing-in-the-console

检查您的项目是否有关联的结算帐户。您可以使用此 Google 工具:https://mapsplatformtransition.withgoogle.com/

"This project does not have a billing account. You will need to add billing information for this project to continue to use Google Maps Platform. The first $200 of monthly usage is free. You only pay for what you use. You can review rates and access your spending any time in your Google Cloud Platform Console, where you can also set daily quotas to protect against unexpected increases. You can also set billing alerts to receive email notifications when charges reach a preset threshold determined by you."

它会列出您使用 Google map 的所有项目,如果项目状态不是“良好状态”,它会告诉您“添加结算”。

关于javascript - 谷歌地图中的 "You have exceeded your request quota for this API",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51685490/

相关文章:

javascript - 特拉维斯上的黑猩猩进行 meteor 测试

javascript - 为什么没有设置 document.cookie?

javascript - 从 JS 中的不可变数组中删除元素的最干净方法是什么?

android - 上传谷歌室内地图? & 如何查看?

Android 谷歌地图 : Failed to load map. 联系谷歌服务器时出错

javascript - 使用 moment.js 查找日期范围之间的完整周数和天数

javascript - 选择类选择器子div Jquery

reactjs - 如果我的基本路线相同,history.push() 在 react 路由器中不起作用

javascript - 如何在 React/Next.js 中更新状态而不进入无限重新渲染循环?

ios - 迦太基和谷歌地图