Avoid some coordinates in routes using Google Directions API Android -


i want avoid coordinates while using directions apis.i have read below blog https://code.google.com/p/gmaps-api-issues/issues/detail?id=214

which ensures directions api doesn't allow if want avoid specific coordinate.

then have tried waypoint parameter (which allow routes include specific coordinate) considering same source , destination:

1) first routes without adding waypoint

https://maps.googleapis.com/maps/api/directions/json?origin=25.2958001,55.436142&destination=24.914744,54.968565&alternatives=true&mode=driving&key=mykey

2) routes adding waypoint (coordinate want avoid)

https://maps.googleapis.com/maps/api/directions/json?origin=25.2958001,55.436142&destination=24.914744,54.968565&waypoints=25.244456,55.404643&alternatives=true&mode=driving&key=mykey

3) compare results , try remove routes 1st step consists 2nd step.

but in case, 1st step returns multiple result passing same coordinate (which want avoid) , results not included 2nd step.

i'm fed this. , need solve anyhow.

anyone can me this? or other suggestions or calculation can me stuff?

thanks,

the question not clear, try provide better approach deal such situations.

since waypoints specified within waypoints parameters , can consist of 1 or more address, recommend using name instead of geocoordinates separated pipe (|). indeed reduce risk of getting faulty results.

on top of can put optimize:true first argument within waypoints parameter allow directions service optimize provided route rearranging waypoints in more efficient order.

here example.

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&key=api_key 

for more details please refer official google documentation.


Comments