Suggested Routes Option in Google Maps API?

前端 未结 1 377
星月不相逢
星月不相逢 2021-01-16 21:35

I have a requirement to show multiple routes between the source and destination. Eg: If i am selecting a source and destination i am able to find one single route. But as in

相关标签:
1条回答
  • 2021-01-16 22:34

    from the documentation:

    provideRouteAlternatives (optional) when set to true specifies that the Directions service may provide more than one route alternative in the response. Note that providing route alternatives may increase the response time from the server.

    example

    var request = {
        origin: start,
        destination: end,
        travelMode: google.maps.DirectionsTravelMode.DRIVING,
        provideRouteAlternatives: true
    };
    
    0 讨论(0)
提交回复
热议问题