0
votes

I am having issue with Google Maps API: When I am requesting following url it returns results https://maps.googleapis.com/maps/api/directions/json?origin=Brooklyn&destination=Queens

But using waypoints=optimize:true returns no data https://maps.googleapis.com/maps/api/directions/json?origin=Brooklyn&destination=Queens&waypoints=optimize:true

I can't understand the reason. Please some one help.

I have checked the doc they said to put waypoints between, but what if origin and destination is dynamic and I don't know the waypoints.

1

1 Answers

0
votes

I believe you don't get any results, because you don't actually pass any waypoints. This is the example request provided in the Docs:

https://maps.googleapis.com/maps/api/directions/json?origin=Adelaide,SA&destination=Adelaide,SA&waypoints=optimize:true|Barossa+Valley,SA|Clare,SA|Connawarra,SA|McLaren+Vale,SA

Try adding some waypoints by appending it to your request and separating them by using the pipe character |.