An elegant way to find shortest and fastest route in Google Maps API v3?

后端 未结 6 839
耶瑟儿~
耶瑟儿~ 2020-12-03 03:46

I am making a taxi fare calculator. One of the business requirements is that, the company wants the shortest and fastest route options. I know Google directionService by def

6条回答
  •  渐次进展
    2020-12-03 04:36

    Use optimizeWaypoints: true  in Request perameter. See below code snippet
    
    var request ={
                    origin: sStartLatLng,
                    destination: sStartLatLng,
                    waypoints: waypts,
                    optimizeWaypoints: true,
                    travelMode: google.maps.DirectionsTravelMode.DRIVING
                };  
    

提交回复
热议问题