Google Maps Directions API - Route not getting plotted for more than 8 waypoints

不羁的心 提交于 2019-12-24 16:51:08

问题


I am trying to draw a route in my project using the Google Maps Directions API but it is not working with waypoints more than 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

As mentioned in the the usage limits page, we are passing our API key in the request and also have billing enabled with our account. But it is only working for routes less than 8 waypoints. What could I be doing wrong?


回答1:


According to Google in this issue the 23 waypoints "extension" to 23 waypoints for free users only applies to the Directions API (the web service), not the Google Maps Javascript API v3 DirectionsService

  • Web Services (Directions API, Distance Matrix API) both free users (API keys) and Maps for Work users (client ID + signature) have 23 waypoints
  • JavaScript API (directions service, distance matrix service): free users (API keys) have 8 waypoints, Maps for Work users (client ID) have 23 waypoints.


来源:https://stackoverflow.com/questions/34808063/google-maps-directions-api-route-not-getting-plotted-for-more-than-8-waypoints

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!