Google Maps Directions API - 不会为超过8个航点绘制路线

时间:2016-01-15 09:33:24

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

我正在尝试使用Google Maps Directions API在我的项目中绘制路线,但它不适用于超过8的航点。

    var request = {
        origin: start,
        destination: end,
        waypoints: waypts,
        optimizeWaypoints: true,
        travelMode: google.maps.TravelMode.DRIVING,
        key: "our-api-key"
    }

https://developers.google.com/maps/documentation/directions/usage-limits

如使用限制页面中所述,我们在请求中传递了API密钥,并且还通过我们的帐户启用了结算功能。但它仅适用于少于8个航点的航线。我能做错什么?

1 个答案:

答案 0 :(得分:1)

根据Google in this issue,免费用户的23个航点“延伸”至23个航路点仅适用于Directions API (the web service),而不适用于Google Maps Javascript API v3 DirectionsService

  
      
  • Web服务(Directions API,Distance Matrix API),免费用户(API密钥)和Maps for Work用户(客户ID +签名)都有23个航路点
  •   
  • JavaScript API(路线服务,距离矩阵服务):免费用户(API密钥)有8个航点,Maps for Work用户(客户端ID)有23个航点。
  •