简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM