本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
如何计算路线的通行费
CalculateRoutes API 可帮助您找到出发地和目的地之间的最佳路线,以及司机休息的最佳机会。它支持汽车、卡车、行人和摩托车等出行模式。它还支持多达 25 个航点(中途停留),包括起点和目的地,但仅有一些限制。
潜在用例
-
计算通行费:能够在路线规划期间计算通行费。
-
审计通行费:能够在旅行后审计通行费。
示例
- Sample request
-
{ "Origin": [ 2.234491, 48.815704 ], "Destination": [ 5.11412, 47.260723 ], "TravelMode": "Car", "Tolls": { "AllTransponders": true, "AllVignettes": true } }
- Sample response
-
{ "LegGeometryFormat": "FlexiblePolyline", "Notices": [], "Routes": [ { "Legs": [ { "Geometry": { "Polyline": "Redacted" }, "TravelMode": "Car", "Type": "Vehicle", "VehicleLegDetails": { "AfterTravelSteps": [], "Arrival": { "Place": { "ChargingStation": false, "OriginalPosition": [ 5.11412, 47.2607229 ], "Position": [ 5.1128203, 47.2596356 ] } }, "Departure": { "Place": { "ChargingStation": false, "OriginalPosition": [ 2.234491, 48.8157039 ], "Position": [ 2.2346482, 48.815674 ] } }, "Incidents": [], "Notices": [], "PassThroughWaypoints": [], "Spans": [], "Tolls": [ { "Country": "FRA", "PaymentSites": [ { "Name": "FLEURY-EN-BIERE", "Position": [ 2.53988, 48.42578 ] }, { "Name": "POUILLY-EN-AUXOIS", "Position": [ 4.56112, 47.25244 ] } ], "Rates": [ { "Id": "2d680295-fb0f-45aa-a8ed-79d9f0f9ff9f", "LocalPrice": { "Currency": "EUR", "Estimate": false, "Range": false, "Value": 21.700000762939453 }, "Name": "APRR", "PaymentMethods": [ "Cash", "BankCard", "CreditCard", "Transponder", "TravelCard" ], "Transponders": [ { "SystemName": "BipandGo" }, { "SystemName": "BipandGo" }, { "SystemName": "BipandGo IDVROOM carpoorling" }, { "SystemName": "Cito30" }, { "SystemName": "Easytrip pass" }, { "SystemName": "Liane 30" }, { "SystemName": "Liber-t" }, { "SystemName": "Liber-t mobilitis" }, { "SystemName": "Pass Pont-Pont" }, { "SystemName": "Progressivi'T Maurienne" }, { "SystemName": "TopEurop" }, { "SystemName": "Tunnel Pass+" }, { "SystemName": "Ulys" }, { "SystemName": "Ulys Europe" }, { "SystemName": "Viaduc-t 30" } ] } ], "Systems": [ 0 ] } ], "TollSystems": [ { "Name": "APRR" } ], "TravelSteps": [ { "Distance": 122, "Duration": 21, "ExitNumber": [], "GeometryOffset": 0, "Type": "Depart" }, { "Distance": 32, "Duration": 7, "ExitNumber": [], "GeometryOffset": 7, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 74, "Duration": 14, "ExitNumber": [], "GeometryOffset": 8, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 199, "Duration": 33, "ExitNumber": [], "GeometryOffset": 9, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 21, "Duration": 10, "ExitNumber": [], "GeometryOffset": 17, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 461, "Duration": 63, "ExitNumber": [], "GeometryOffset": 20, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 1557, "Duration": 145, "ExitNumber": [], "GeometryOffset": 41, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Left", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 3471, "Duration": 151, "ExitNumber": [], "GeometryOffset": 135, "RoundaboutExitStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "RoundaboutExit" }, { "Distance": 9796, "Duration": 430, "ExitNumber": [], "GeometryOffset": 242, "RampStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "Ramp" }, { "Distance": 2473, "Duration": 112, "ExitNumber": [], "ExitStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "GeometryOffset": 582, "Type": "Exit" }, { "Distance": 674, "Duration": 25, "ExitNumber": [], "GeometryOffset": 669, "Type": "Continue" }, { "Distance": 253953, "Duration": 7468, "ExitNumber": [], "GeometryOffset": 679, "Type": "Continue" }, { "Distance": 37379, "Duration": 1192, "ExitNumber": [], "ExitStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "GeometryOffset": 5701, "Type": "Exit" }, { "Distance": 2021, "Duration": 110, "ExitNumber": [], "GeometryOffset": 6695, "RoundaboutExitStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "RoundaboutExit" }, { "Distance": 7380, "Duration": 316, "ExitNumber": [], "GeometryOffset": 6776, "RoundaboutPassStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "RoundaboutPass" }, { "Distance": 4253, "Duration": 156, "ExitNumber": [], "GeometryOffset": 6987, "KeepStepDetails": { "Intersection": [], "SteeringDirection": "Left" }, "Type": "Keep" }, { "Distance": 813, "Duration": 54, "ExitNumber": [], "GeometryOffset": 7081, "RampStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "Ramp" }, { "Distance": 1909, "Duration": 109, "ExitNumber": [], "GeometryOffset": 7133, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Left", "TurnIntensity": "Sharp" }, "Type": "Turn" }, { "Distance": 827, "Duration": 47, "ExitNumber": [], "GeometryOffset": 7182, "Type": "Continue" }, { "Distance": 680, "Duration": 41, "ExitNumber": [], "GeometryOffset": 7216, "RoundaboutExitStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "RoundaboutExit" }, { "Distance": 224, "Duration": 12, "ExitNumber": [], "GeometryOffset": 7258, "Type": "Continue" }, { "Distance": 25, "Duration": 2, "ExitNumber": [], "GeometryOffset": 7265, "Type": "Continue" }, { "Distance": 748, "Duration": 51, "ExitNumber": [], "GeometryOffset": 7267, "Type": "Continue" }, { "Distance": 656, "Duration": 46, "ExitNumber": [], "GeometryOffset": 7299, "RoundaboutExitStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "RoundaboutExit" }, { "Distance": 1119, "Duration": 78, "ExitNumber": [], "GeometryOffset": 7329, "Type": "Continue" }, { "Distance": 432, "Duration": 26, "ExitNumber": [], "GeometryOffset": 7383, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 1864, "Duration": 100, "ExitNumber": [], "GeometryOffset": 7402, "RoundaboutExitStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "RoundaboutExit" }, { "Distance": 1110, "Duration": 93, "ExitNumber": [], "GeometryOffset": 7470, "RoundaboutExitStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "RoundaboutExit" }, { "Distance": 232, "Duration": 10, "ExitNumber": [], "GeometryOffset": 7563, "Type": "Continue" }, { "Distance": 642, "Duration": 29, "ExitNumber": [], "GeometryOffset": 7572, "Type": "Continue" }, { "Distance": 357, "Duration": 25, "ExitNumber": [], "GeometryOffset": 7580, "Type": "Continue" }, { "Distance": 63, "Duration": 10, "ExitNumber": [], "GeometryOffset": 7600, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 2626, "Duration": 411, "ExitNumber": [], "GeometryOffset": 7602, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 234, "Duration": 37, "ExitNumber": [], "GeometryOffset": 7627, "Type": "Continue" }, { "Distance": 0, "Duration": 0, "ExitNumber": [], "GeometryOffset": 7632, "Type": "Arrive" } ], "TruckRoadTypes": [], "Zones": [] } } ], "MajorRoadLabels": [ { "RouteNumber": { "Language": "fr", "Value": "A6" } } ] } ] }
- cURL
-
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/routes?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "Origin": [ 2.234491, 48.815704 ], "Destination": [ 5.11412, 47.260723 ], "TravelMode": "Car", "Tolls": { "AllTransponders": true, "AllVignettes": true } }'
- AWS CLI
-
aws geo-routes calculate-routes --key ${YourKey} \ --origin 13.055211 52.704802 \ --destination 13.551910 52.282705 \ --travel-mode "Car" \ --tolls '{"AllTransponders": true, "AllVignettes": true}'
寻找备选路线
使用自定义避让来计算路线