"You have exceeded your request quota for this API" 反应-google-映射Javascript API

"You have exceeded your request quota for this API" react-google-maps Javascript API

我正在尝试使用 react-google-maps 绘制路径。我可以毫无问题地显示地图,但是当我添加折线组件时,地图就好像我已经达到配额一样。我还没有接近配额。

是的,之前有人问过这个问题。不,启用计费不是解决此问题的方法。

相关代码如下:

按预期工作(无多项式):

<div classname="Maps" style={{ height: '55vh', width: '44.3%', float:  'right'}}>

      <GoogleMapReact
        defaultCenter={center}
        defaultZoom={zoom}
        bootstrapURLKeys={{ key:'MY_API_KEY'}}


      </GoogleMapReact>
    </div>

抛出错误:

<div classname="Maps" style={{ height: '55vh', width: '44.3%', float: 'right'}}>

      <GoogleMapReact
        defaultCenter={center}
        defaultZoom={zoom}
        bootstrapURLKeys={{ key:'MY_API_KEY'}}

      >
        <Polyline 
          path={path} 
          options={{ 
            strokeColor: '#00ffff',
            strokeOpacity: 1,
            strokeWeight: 2,
            icons: [{ 
              icon: "hello",
              offset: '0',
              repeat: '10px'
            }],
          }}
        />

      </GoogleMapReact>
    </div>

控制台中显示的错误是:"You have exceeded your request quota for this API. See https://developers.google.com/maps/documentation/javascript/error-messages?utm_source=maps_js&utm_medium=degraded&utm_campaign=billing#api-key-and-billing-errors"

解决方案:改用react-leaflet。

如果我真的需要帮助,似乎我应该听从这个建议:https://meta.wikimedia.org/wiki/Cunningham%27s_Law