0

我有这样的代码:

var directions = new google.maps.DirectionsService();
    var request = {
        origin: start,
        destination: destination,
        waypoints: waypoints,
        provideRouteAlternatives: false,
        unitSystem: @(Model.SessionService.GetDivision().DistanceUnits.MeasurementSystem.ID == 1 ? "google.maps.UnitSystem.METRIC" : "google.maps.UnitSystem.IMPERIAL"),
        travelMode: google.maps.DirectionsTravelMode.DRIVING
    };

    directions.route(request, function(response, status) {

……

它工作得很好,但是可以用不同的选项计算路线吗?喜欢最短路线还是最快路线?谷歌允许吗?

4

1 回答 1

1

默认情况下,您将获得最佳路线。

您所能做的就是向请求对象提供provideRouteAlternatives = true,然后检查最短距离的结果/其他任何符合您的标准的结果。

于 2013-08-22T16:11:50.800 回答