Maxime Claude
Maxime Claude

Reputation: 995

A http request to google maps api direction with waypoints

I'm working on an android app, using directions google maps api v2. It is said here that I can put, up to "8 waypoints" in my http request (I assume plus the origin and the destination points). So, my code generates the request below (I ordered it so you could count the number of waypoints).

https://maps.googleapis.com/maps/api/directions/json?origin=45.509166,-73.497897&destination=5.5027,-73.503455&waypoints=optimize:true| 45.509196,-73.495494| 45.511166,-73.493584| 45.515887,-73.500751| 45.516835,-73.507189| 45.51497,-73.514892| 45.507828,-73.515879| 45.504038,-73.516008| 45.508971,-73.505665| &sensor=false&API_KEY

This is the answer I get:

{
   "routes" : [],
   "status" : "ZERO_RESULTS"
}

Can one help me understand what is wrong? Does my request has an error, or I'm bypassing the limits of the direction google maps api?

Upvotes: 4

Views: 2897

Answers (2)

Brad Newland
Brad Newland

Reputation: 47

Admittedly a guess, remove the optimization of waypoints? Wouldn't the optimization change where you have set them?

I do know you can use the Directions Response Elements to throw you some status codes to help debugging. "NOT_FOUND indicates at least one of the locations specified in the request's origin, destination, or waypoints could not be geocoded."

Upvotes: 0

Related Questions