本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
如何查找带有 turn-by-turn方向的路线
CalculateRoutes API 可帮助您找到出发地和目的地之间的最佳路线,以及司机休息的最佳机会。它支持汽车、卡车、行人和摩托车等出行模式。它还支持多达 25 个航点(中途停留),包括起点和目的地,但仅有一些限制。
潜在用例
-
创建导航移动应用程序:使用 API 获取 turn-by-turn导航说明。
-
在 Web 平台上显示路线:显示 Web 应用程序的详细路线指南,以帮助您进行导航。
示例
- Sample request
-
{ "Origin": [ -123.118105, 49.282423 ], "Destination": [ -123.020098, 49.232872 ], "TravelStepType": "TurnByTurn", "TravelMode": "Car" }
- Sample response
-
{ "LegGeometryFormat": "FlexiblePolyline", "Notices": [], "Routes": [ { "Legs": [ { "Geometry": { "Polyline": "Redacted" }, "TravelMode": "Car", "Type": "Vehicle", "VehicleLegDetails": { "Arrival": { "Place": { "Position": [-123.0203051, 49.2328499] } }, "Departure": { "Place": { "Position": [-123.1180883, 49.2824349] } }, "TravelSteps": [ { "Distance": 1288, "Duration": 102, "Type": "Depart", "NextRoad": { "RoadName": "W Georgia St", "RouteNumber": "HWY-1A" } }, { "Distance": 262, "Duration": 24, "Type": "Keep", "NextRoad": { "RoadName": "Main St", "RouteNumber": "HWY-1A" } }, { "Distance": 1356, "Duration": 134, "Type": "Turn", "NextRoad": { "RoadName": "Main St", "RouteNumber": "HWY-1A" } }, { "Distance": 7092, "Duration": 568, "Type": "Keep", "NextRoad": { "RoadName": "Kingsway", "RouteNumber": "HWY-1A" } }, { "Distance": 65, "Duration": 26, "Type": "Turn" }, { "Distance": 0, "Duration": 0, "Type": "Arrive" } ] } } ] } ] }
- 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": [ -123.118105, 49.282423 ], "Destination": [ -123.020098, 49.232872 ], "TravelStepType": "TurnByTurn", "TravelMode": "Car" }'
- AWS CLI
-
aws geo-routes calculate-routes --key ${YourKey} \ --origin -123.118105 49.282423 \ --destination -123.020098 49.232872 \ --travel-step-type "TurnByTurn" \ --travel-mode "Car"
查找出发地和目的地的路线
找出路段的限速