交通ルートを計算します
ユーザーストーリー
ローマフィウミチーノ国際空港のターミナル 1 からローマテルミニ中央駅までの公共交通機関を利用したトランジットルートをリクエストする場合。
リクエスト
トランジットルートの計算は、 1 つの GET 要求で構成されます。 必須のパラメータは、フォーム <latitude>,<longitude>
内の 2 つの WGS84 座標のペアによって指定された origin
およびdestination
のみです。 次のリクエストでは、デフォルトのオプションを使用してトランジットルートが計算されます。
GET https://transit.router.hereapi.com/v8/routes
?origin=41.79457,12.25473
&destination=41.90096,12.50243
オプションのパラメータ alternatives
は、最適なルートを除いて戻る代替ルートの数を表します。 デフォルトで alternatives=0
は、設定されていない場合、最適なルートが 1 つだけ返されます。
レスポンス
ルートの計算が成功した場合 /routes
、応答には計算されたルートについて要求された詳細情報が含まれます。
alternatives
が 0 より大きい場合を除き、最適な 1 つの配送ルート - 複数の輸送セクションがあり、各セグメント(歩行者または輸送セグメントを表す)には、出発 / 到着時間、所要時間、および座標が含まれています
- 輸送セグメントには、実際の配達地点または出発地と到着地が表示されます。 必要に応じて、中間のすべての中継地点もパラメータを使用して要求できます
return=intermediate
- 代替品に含まれているサービスを実行するオペレータのセット。オペレータコード、オペレータ名、オペレータの Web サイトへのリンク ( 存在する場合 ) などが含まれます。
{
"routes": [
{
"id": "R0023c9-C0",
"sections": [
{
"id": "R0023c9-C0-S0",
"type": "pedestrian",
"departure": {
"time": "2020-04-22T12:02:00+02:00",
"place": {
"type": "place",
"location": {
"lat": 41.79457,
"lng": 12.25473
}
}
},
"arrival": {
"time": "2020-04-22T12:08:00+02:00",
"place": {
"name": "Fiumicino Aeroporto",
"type": "station",
"location": {
"lat": 41.793466,
"lng": 12.251997
},
"id": "415713377"
}
}
},
{
"id": "R0023c9-C0-S1",
"type": "transit",
"departure": {
"time": "2020-04-22T12:08:00+02:00",
"place": {
"name": "Fiumicino Aeroporto",
"type": "station",
"location": {
"lat": 41.793466,
"lng": 12.251997
},
"id": "415713377"
}
},
"arrival": {
"time": "2020-04-22T12:40:00+02:00",
"place": {
"name": "Roma Termini",
"type": "station",
"location": {
"lat": 41.90054,
"lng": 12.502168
},
"id": "415712984"
}
},
"transport": {
"mode": "regionalTrain",
"name": "LE",
"category": "Regional Train",
"color": "#4C8DC1",
"textColor": "#000000",
"headsign": "Roma Termini"
},
"agency": {
"id": "aDmtre00",
"name": "Trenitalia",
"website": "http://www.trenitalia.com/"
},
"attributions": [
{
"id": "R0023c9-C0-S1-link-0",
"href": "http://creativecommons.org/licenses/by/3.0/it/",
"text": "Some line names used in this product or service were edited to align with official transportation maps.",
"type": "disclaimer"
}
]
},
{
"id": "R0023c9-C0-S2",
"type": "pedestrian",
"departure": {
"time": "2020-04-22T12:40:00+02:00",
"place": {
"name": "Roma Termini",
"type": "station",
"location": {
"lat": 41.90054,
"lng": 12.502168
},
"id": "415712984"
}
},
"arrival": {
"time": "2020-04-22T12:41:00+02:00",
"place": {
"type": "place",
"location": {
"lat": 41.90096,
"lng": 12.50243
}
}
}
}
]
}
]
}