Search code examples
androidgoogle-mapsgoogle-maps-api-2

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?


Solution

  • enter image description heremay your url is missing something change with this new url

    https://maps.googleapis.com/maps/api/directions/json?origin=45.509166,-73.497897&destination=50.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