How to use the Google Directions API json to find a route between more than 25 waypoints?

36 views Asked by At

I'm using the json 'Directions API requests' function but it errors out after 25 stops - I get the response "Too many waypoints in the request. The maximum number of waypoints is 25". I've found mixed information on if the directions API can route between more than 25 stops. One of the Google references says I can route to more than 25 stops if I use lat/long - but I am using lat/long and I'm still getting the error message.

Do I need to format my request differently to use the API for more than 25 stops? How should I construct my URL request?

My GET requests look like:

"https://maps.googleapis.com/maps/api/directions/json?" + lat/long for 15 to 30 waypoints + "&waypoints=optimize:true|" + my API key

For routes with 25 or fewer waypoints - Success!

For routes with 26+ waypoints: "Too many waypoints in the request. The maximum number of waypoints is 25"

0

There are 0 answers