如何从Bing Maps V8获取路线货币成本

时间:2019-05-17 08:26:32

标签: javascript bing-maps bing-api

我使用Bing Maps V8的“方向”模块创建了一条路线,将“驾驶”设置为路线模式,现在我想获得该路线的货币成本,或者如果可能的话,可以从高速公路上获得费用。

我在文档中看到DirectionStep对象具有货币成本参数,但我无法达到目标

这是我的代码:

Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
            //Create an instance of the directions manager.
            var directionsManager = new 
            Microsoft.Maps.Directions.DirectionsManager(map);

            var partenzaWaypoint = new Microsoft.Maps.Directions.Waypoint({ 
            address: 'Partenza', location: new Microsoft.Maps.Location( 
            newPartenzaMappaLat, newPartenzaMappaLon ) });

            directionsManager.addWaypoint(partenzaWaypoint);

            for ( var i = 0; i < puntiPercorsoMappaArray.length; i++ )
            {
                var waypoint = new Microsoft.Maps.Directions.Waypoint({ 
                address: puntiPercorsoMappaArray[i]['dest'], location: new 
                Microsoft.Maps.Location( puntiPercorsoMappaArray[i].latMappa, 
                puntiPercorsoMappaArray[i].longMappa ) });

                directionsManager.addWaypoint(waypoint);
            }

            var arrivoWaypoint = new Microsoft.Maps.Directions.Waypoint({ 
            address: 'Arrivo', location: new Microsoft.Maps.Location( 
            newArrivoMappaLat, newArrivoMappaLon ) });

            directionsManager.addWaypoint(arrivoWaypoint);

            directionsManager.setRequestOptions(
            {
                routeMode: Microsoft.Maps.Directions.RouteMode.driving,
                routeDraggable: false,
                maxRoutes: 1
            });

            //Specify the element in which the itinerary will be rendered.
            directionsManager.setRenderOptions(
            { 
                itineraryContainer: '#directions-panel',
                displayPostItineraryItemHints: false,
                displayPreItineraryItemHints: false,
                displayRouteSelector: false
            });

            //Calculate directions.
            directionsManager.calculateDirections();

        });

0 个答案:

没有答案