“您已超出此API的请求配额”react-google-maps Javascript API

问题描述 投票:-3回答:1

我正在尝试使用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>

控制台中显示的错误是:“您已超出此API的请求配额。请参阅https://developers.google.com/maps/documentation/javascript/error-messages?utm_source=maps_js&utm_medium=degraded&utm_campaign=billing#api-key-and-billing-errors

google-cloud-platform polyline google-maps-react
1个回答
-1
投票

解决方案:使用react-leaflet代替。

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

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