View a markdown version of this page

如何尋找模式間路由 - Amazon Location Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

如何尋找模式間路由

CalculateRoutes API 支援Intermodal旅行模式,以計算在單一行程中結合多種傳輸類型的路由,例如駕駛到park-and-ride車位置,然後公有傳輸到目的地。行人腿部一律會啟用,以便在其他傳輸類型之間連線。

潛在的使用案例

  • 停靠和乘車:行駛至交通站、停靠和進行公有乘車,以避免城市中心的擁塞和停車費用。使用Vehicle已啟用 FirstLegTaxiRental已停用 的 。

  • 計程車和乘車:從起點搭計程車到連線良好的傳輸站,然後在旅程的剩餘時間內切換到公有傳輸。這適用於公有運輸未良好連線的區域,或您想要完全避免停車的區域。使用Taxi已啟用 FirstLegVehicleRental已停用 的 。

  • 最後一哩傳輸:為大部分的旅程進行公有傳輸,並在最後一條路使用計程車或租車前往最終目的地。

範例

Sample request
{ "Origin": [ -122.3088, 47.4502 ], "Destination": [ -122.3331, 47.6097 ], "TravelMode": "Intermodal", "TravelModeOptions": { "Intermodal": { "Vehicle": { "EnabledFor": ["FirstLeg"] }, "Taxi": { "EnabledFor": ["None"] }, "Rental": { "EnabledFor": ["None"] } } }, "DepartNow": true }
Sample response
{ "LegGeometryFormat": "FlexiblePolyline", "Notices": [], "Routes": [ { "Legs": [ { "Geometry": { "Polyline": "Redacted" }, "TravelMode": "Car", "Type": "Vehicle", "VehicleLegDetails": { "AfterTravelSteps": [ { "Duration": 300, "Type": "Park" } ], "Arrival": { "Place": { "Name": "Ipm Lot", "Position": [ -122.3264, 47.58003 ], "Type": "ParkingLot" }, "Time": "2026-05-19T15:32:00-07:00" }, "Departure": { "Place": { "Position": [ -122.3088, 47.4502 ] }, "Time": "2026-05-19T15:12:00-07:00" }, "Summary": { "Overview": { "Distance": 20493, "Duration": 1500 }, "TravelOnly": { "Duration": 1200 } } } }, { "Geometry": { "Polyline": "Redacted" }, "PedestrianLegDetails": { "Arrival": { "Place": { "Name": "Sodo Station Northeast Entrance", "Position": [ -122.327329, 47.580637 ], "Type": "AccessPoint" }, "Time": "2026-05-19T15:39:00-07:00" }, "Departure": { "Place": { "Name": "Ipm Lot", "Position": [ -122.3264, 47.58003 ], "Type": "ParkingLot" }, "Time": "2026-05-19T15:37:00-07:00" } }, "TravelMode": "Pedestrian", "Type": "Pedestrian" }, { "Geometry": { "Polyline": "Redacted" }, "TravelMode": "LightRail", "Type": "Transit", "TransitLegDetails": { "Agency": { "Name": "Sound Transit", "Url": "https://www.soundtransit.org" }, "Arrival": { "Place": { "Name": "Symphony", "Position": [ -122.33602, 47.60781 ], "Type": "Station" }, "Time": "2026-05-19T15:48:00-07:00" }, "Departure": { "Place": { "Name": "Sodo", "Position": [ -122.32739, 47.581074 ], "Type": "Station" }, "Time": "2026-05-19T15:40:00-07:00" }, "Summary": { "Overview": { "Distance": 3174, "Duration": 480 }, "TravelOnly": { "Duration": 480 } }, "Transport": { "Color": "#28813F", "Headsign": "Lynnwood City Center", "Mode": "LightRail", "RouteName": "1 Line", "ShortRouteName": "1 Line", "TextColor": "#FFFFFF" } } }, { "Geometry": { "Polyline": "Redacted" }, "PedestrianLegDetails": { "Arrival": { "Place": { "Position": [ -122.3331, 47.6097 ] }, "Time": "2026-05-19T15:55:00-07:00" }, "Departure": { "Place": { "Name": "Symphony Station Entrance A1", "Position": [ -122.335875, 47.607929 ], "Type": "AccessPoint" }, "Time": "2026-05-19T15:49:00-07:00" } }, "TravelMode": "Pedestrian", "Type": "Pedestrian" } ], "Summary": { "Distance": 24183, "Duration": 2280 } } ] }
cURL
curl --request POST \ --url 'https://routes.geo.us-east-1.amazonaws.com/v2/routes?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "Origin": [ -122.3088, 47.4502 ], "Destination": [ -122.3331, 47.6097 ], "TravelMode": "Intermodal", "TravelModeOptions": { "Intermodal": { "Vehicle": { "EnabledFor": ["FirstLeg"] }, "Taxi": { "EnabledFor": ["None"] }, "Rental": { "EnabledFor": ["None"] } } }, "DepartNow": true }'
AWS CLI
aws geo-routes calculate-routes \ --origin -122.3088 47.4502 \ --destination -122.3331 47.6097 \ --travel-mode "Intermodal" \ --travel-mode-options '{"Intermodal": {"Vehicle": {"EnabledFor": ["FirstLeg"]}, "Taxi": {"EnabledFor": ["None"]}, "Rental": {"EnabledFor": ["None"]}}}' \ --depart-now