運賃計算例: 北千住 ⇒ 渋谷
- 経路の概要
- 定期券区間は「東京メトロ千代田線 北千住~表参道」間とする。
- 北千住~表参道間は定期券区間「内」となり、運賃は「0円」となる。
- 表参道~渋谷間は定期券区間「外」となり、普通運賃(170円)/IC運賃(168円)となる。
■経路全体の運賃
- レスポンス内の「items>summary>move>fare」 配下に出力されます。
"move": { "transit_count": 1, "fare": { "unit_0": 250.0, "unit_48": 242.0, "unit_112": 170.0, // 定期券考慮運賃(定期券区間外)の総額 "unit_113": 0, // 定期券考慮運賃(定期区間**内完結**)の総額 "unit_114": 168.0, // 定期券考慮IC運賃 "unit_128_train": 8820.0, "unit_130_train": 25140.0, "unit_133_train": 47630.0 }, "type": "move", "from_time": "2020-05-11T15:01:00+09:00", "to_time": "2020-05-11T15:37:00+09:00", "time": 36, "distance": 17800 }
■定期券を考慮した結果を反映した運賃
- レスポンス内の「items>fares>transport>fare」 配下に出力される下記3種の運賃を用います。
- unit_112:定期券考慮運賃(定期区間外)
- unit_113:定期券考慮運賃(定期区間内完結)
- unit_114:定期券考慮IC運賃
- これらの運賃は区間ごとに出力されますので、すべての出力結果を参照し足し合わせることでルート全体の定期券考慮運賃を求めます(下記の経路例では1回ずつ出力されています)
- 定期券考慮IC運賃の加算結果が「items>summary>move>fare」の金額よりも高い場合、定期券考慮IC運賃は「items>summary>move>fare」の金額となります。
"fares": [ { "type": "point", "coord": { "lat": 35.749759, "lon": 139.804566 }, "name": "北千住", "node_id": "00008355", "node_types": [ "station" ], "numbering": { // 一部省略 } }, { "use_commuter_pass": true, // 定期券を利用したかどうか、の判定結果 "next_transit": true, "transport": { "fare": { "unit_113": 0.0 // 「北千住~表参道」の定期券区間内運賃 }, "color": "#00BB85", "destination": { "name": "代々木上原", "id": "00005508" }, "type": "普通", "fare_break": { "unit_113": true }, "getoff": "7", "name": "東京メトロ千代田線", "fare_season": "normal", "self_id": "0085023f", "company": { "id": "00000113", "name": "東京地下鉄(メトロ)" }, "links": [ { "id": "00000769", "name": "東京メトロ千代田線", "direction": "up", "destination": { "name": "代々木上原", "id": "00005508" }, "from": { "name": "北千住", "id": "00008355" }, "to": { "name": "表参道", "id": "00007820" }, "is_timetable": "false" } ], "id": "00000566", "train_id": "A1449S", "fare_detail": [ // 一部省略 ] }, "type": "move", "move": "local_train", "from_time": "2020-05-11T15:01:00+09:00", "to_time": "2020-05-11T15:31:00+09:00", "time": 30, "distance": 16500, "line_name": "東京メトロ千代田線" }, { "type": "point", "coord": { "lat": 35.665777, "lon": 139.711294 }, "name": "表参道", "node_id": "00007820", "node_types": [ "station" ], "numbering": { // 一部省略 } }, { "transport": { "fare": { "unit_112": 170.0, // 定期券区間外の普通運賃 "unit_114": 168.0 // 定期券区間外のIC運賃 }, "color": "#8F76D6", "destination": { "name": "長津田", "id": "00006248" }, "type": "普通", "fare_break": { "unit_112": true, "unit_114": true }, "name": "東京メトロ半蔵門線", "fare_season": "normal", "self_id": "824b0347", "company": { "id": "00000113", "name": "東京地下鉄(メトロ)" }, "links": [ { "id": "00000774", "name": "東京メトロ半蔵門線", "direction": "down", "destination": { "name": "渋谷", "id": "00003544" }, "from": { "name": "表参道", "id": "00007820" }, "to": { "name": "渋谷", "id": "00003544" }, "is_timetable": "false" } ], "id": "00000451", "train_id": "B1514K", "fare_detail": [ // 一部省略 ] }, "type": "move", "move": "local_train", "from_time": "2020-05-11T15:35:00+09:00", "to_time": "2020-05-11T15:37:00+09:00", "time": 2, "distance": 1300, "line_name": "東京メトロ半蔵門線" }, { "type": "point", "coord": { "lat": 35.659458, "lon": 139.701302 }, "name": "渋谷", "node_id": "00003544", "node_types": [ "station" ], "numbering": { "arrival": [ { "symbol": "Z", "number": "01" } ] } } ]