コンテンツにスキップ

ルート形状取得(トータルナビ)

/shape_transit [GET]

基本情報

概要

電車(航空路線、徒歩含む)を移動手段として2地点間のルートを検索し、その結果を形状で取得します。

URL

https://{HOST}/{CID}/v1/shape_transit

※APIマーケットの場合はURL体系が異なります

出力形式

  • GeoJSON
  • JSON

対応言語

  • ja

パラメータ

  • 「ルート検索(トータルナビ) /route_transit」と同等のパラメータを受け付けます

利用できないパラメータについて

本APIは以下パラメータには対応してません
・lang

  • 本API独自のパラメータは以下の通りです
パラメータ名 必須 概要 型名 デフォルト値 上下限/選択値 備考
options 追加出力情報 文字列 transport_shape:公共交通路線形状 transport_shapeを指定しても、路線形状が存在しない場合は形状情報が出力されません
no 経路番号 数値 複数経路が返却される際に、1つの経路を特定する必要があります

出力する経路番号を指定します
未指定の場合は一番最初の経路が選択されます
format 出力形式 文字列 geojson geojson:GeoJSON 形式
json:JSON 形式
shape_color 経路形状の色分け 文字列 railway_line:鉄道路線毎の線色を使用

 

徒歩+公共交通機関のルートの場合、'options=transport_shape'を付与しないと徒歩ルートの形状のみが出力されます。
公共交通機関のみの乗換ルートの場合、'options=transport_shape'を付与しないと形状情報が出力されません。

フォーマットについて

GeoJSON は地理形状を表現する一般的なフォーマットです。
GeoJSON形式の出力結果は、/map_script で利用できます。
JSON形式の出力結果は、/map_image で利用できます。

パラメータ構成例

・出発地:表参道ヒルズ、到着駅:千葉、出発時刻:2019年10月1日8時、のルート形状をGeoJSONで取得(路線形状付き)

/shape_transit?start={"lat":35.663836,"lon":139.712258,"name":"表参道ヒルズ"}&goal=00005172&format=geojson&options=transport_shape&start_time=2019-10-01T08:00:00

 

JSON 表現は URL エンコードをした上でリクエストしてください

レスポンス(GeoJSON)

  • パラメータ「format=geojson」と指定した場合に出力されるGeoJSONオブジェクトを以下に記載します

FeatureCollectionオブジェクト

名称 レスポンス名 型名 配列 説明
種別 type 文字列 FeatureCollection を表すタイプ名'FeatureCollection'を出力
形状に関する情報 features Featureオブジェクト 〇
形状全体のバウンディングボックス bbox 数値 〇

Featureオブジェクト

名称 レスポンス名 型名 配列 説明
種別 type 文字列 Feature を表すタイプ名'Feature'を出力
形状全体のバウンディングボックス bbox 数値 〇
形状の緯度経度情報 geometry Geometryオブジェクト
形状のメタ情報 properties Propertyオブジェクト ガイダンスポイント情報や線の属性などを保存

Geometryオブジェクト

名称 レスポンス名 型名 配列 説明
種別 type 文字列 Geometry を表すタイプ名'LineString'を出力
緯度経度 coordinates カンマ区切りの緯度経度の配列 〇

Propertyオブジェクト

名称 レスポンス名 型名 配列 説明
移動情報 ways 文字列 'walk'または'transport'が入る
区間区分群 section 文字列 出発地/経由地/目的地のまとまりを示す
線(内側) inline Lineオブジェクト
線(外側) outline Lineオブジェクト
経路番号 route_no 文字列
公共交通機関種別 transport_type 文字列
屋内ルートフラグ indoor 真偽値
規制突破フラグ restriction 真偽値

Lineオブジェクト

名称 レスポンス名 型名 配列 説明
線種 line_style 文字列 次のいずれかの文字列
- solid:実線
- auxiliary:補助線
線の幅(単位:px) width 文字列
線の色 color 文字列 色(RGB形式)
透過度 opacity 数値 透過度(0.0~1.0)
線端の形状 strokelinecap 文字列 線の両端の形状
常に'round'が入る
- round:丸い線端
角の形状 strokelinejoin 文字列 コーナーポイントの形状
常に'round'が入る
- round:丸い角

bbox(バウンディングボックス)について

GeoJSON形式のレスポンスに含まれるはバウンディングボックスとは、形状全体を包み込む四角形の緯度経度を最高値から最低値に向かって記述したものです。
これを利用すると、形状全体が描画される尺度を地図スクリプトに教えられます。

GeoJSON形式の形状で得られる線のスタイルについて

詳細はこちらからご確認いただけます。

パラメータ構成例

・出発地:表参道ヒルズ、到着駅:千葉、出発時刻:2019年10月1日8時、のルート形状をJSONで取得(路線形状付き)

/shape_transit?{"lat":35.663836,"lon":139.712258,"name":"表参道ヒルズ"}&goal=00005172&format=json&options=transport_shape&start_time=2019-10-01T08:00:00

 

JSON 表現は URL エンコードをした上でリクエストしてください

レスポンス(JSON)

  • パラメータ「format=json」と指定した場合に出力されるJSONオブジェクトを以下に記載します
名称 レスポンス名 型名 配列 説明
検索結果一覧 items RouteShapeオブジェクト 〇
単位情報 unit Unitオブジェクト

RouteShapeオブジェクト

名称 レスポンス名 型名 配列 説明
マーカー一覧 marker Markerオブジェクト 〇
パス一覧 path Pathオブジェクト 〇

Markerオブジェクト

名称 レスポンス名 型名 配列 説明
画像の起点場所 position 文字列 次のいずれかの文字列
bottom:下
bottom_left:左下
bottom_right:右下
left:左
center:中央
right:右
top:上
top_left:左上
top_right:右上
default:デフォルト
中心緯度経度列 centers Coordinateオブジェクト 〇

Coordinateオブジェクト

名称 レスポンス名 型名 配列 説明
緯度 lat 数値
経度 lon 数値

Pathオブジェクト

名称 レスポンス名 型名 配列 説明
緯度経度列 coords カンマ区切りの緯度経度の配列 〇
線の幅 width 数値
線の色 color 文字列
透過度 opacity 数値
道路種別 road_type 文字列 次のいずれかの文字列
highway:高速道路
local:一般道路
ferry:フェリー

Unitオブジェクト

名称 レスポンス名 型名 配列 説明
測地系 datum 文字列
緯度経度の出力形式 coord_unit 文字列

レスポンス例

・GeoJSON形式

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "bbox": [
                139.712258,
                35.663836,
                139.712264,
                35.663843
            ],
            "geometry": {
                "type": "LineString",
                "coordinates": [
                    [
                        139.712258,
                        35.663836
                    ],
                    [
                        139.712264,
                        35.663843
                    ]
                ]
            },
            "properties": {
                "ways": "walk",
                "section": "0001,0002,0003,0004",
                "inline": {
                    "line_style": "auxiliary",
                    "color": "#BFBFBF",
                    "width": 7,
                    "opacity": 0.76,
                    "strokelinecap": "round",
                    "strokelinejoin": "round"
                },
                "outline": {
                    "line_style": "dashed",
                    "color": "#0A6400",
                    "width": 10,
                    "opacity": 0.5,
                    "strokelinecap": "round",
                    "strokelinejoin": "round"
                },
                "route_no": "1"
            }
        },
        {
            ・・・
        },
        {
            "type": "Feature",
            "bbox": [
                139.701817,
                35.658809,
                139.712602,
                35.665293
            ],
            "geometry": {
                "type": "LineString",
                "coordinates": [
                    [
                        139.712602,
                        35.665293
                    ],
                    [
                        ・・・
                    ],
                    [
                        139.701817,
                        35.658809
                    ]
                ]
            },
            "properties": {
                "ways": "transport",
                "section": "0001,0002,0003,0004",
                "inline": {
                    "line_style": "solid",
                    "color": "#004EFF",
                    "width": 7,
                    "opacity": 0.76,
                    "strokelinecap": "round",
                    "strokelinejoin": "round"
                },
                "outline": {
                    "line_style": "solid",
                    "color": "#00174C",
                    "width": 10,
                    "opacity": 0.5,
                    "strokelinecap": "round",
                    "strokelinejoin": "round"
                },
                "route_no": "1",
                "transport_type": "railway"
            }
        },
        {
            ・・・
        }
    ],
    "bbox": [
        139.544671,
        35.649545,
        139.712602,
        35.670739
    ]
}

・JSON形式

{
    "items": [
        {
            "marker": [ ],
            "path": [
                {
                    "coords": [
                        [
                            35.663836,
                            139.712258
                        ],
                        [
                            ・・・
                        ],
                        [
                            35.663843,
                            139.712264
                        ]
                    ],
                    "width": 7,
                    "color": "#BFBFBF",
                    "opacity": 0.76
                },
                {
                    ・・・
                },
                {
                    "coords": [
                        [
                            35.649923,
                            139.551333
                        ],
                        [
                            ・・・
                        ],
                        [
                            35.651811,
                            139.544671
                        ]
                    ],
                    "width": 7,
                    "color": "#BFBFBF",
                    "opacity": 0.76
                }
            ]
        }
    ],
    "unit": {
        "datum": "wgs84",
        "coord_unit": "degree"
    }
}

エラー情報

エラーハンドリングについて

エラーメッセージは追加/変更/削除されることがあります。
エラーハンドリングされる場合はHTTPステータスコードをもとにご対応ください。
共通エラーについてはこちらをご参照ください。

HTTPステータス エラーメッセージ 発生理由
405 This http method is invalid : [method] 許可されていないHTTPメソッドでリクエストした場合に発生します。
400 parameter error: start: required field startパラメータが未指定の場合に発生します。
400 parameter error: start: no definitions validate startがJSON・交通拠点ID・座標のいずれの形式にも合致しない場合に発生します。
400 parameter error: goal: required field goalパラメータが未指定の場合に発生します。
400 parameter error: goal: no definitions validate goalがJSON・交通拠点ID・座標のいずれの形式にも合致しない場合に発生します。
400 parameter error: start_time: required field start_time・goal_time・first_operation・last_operationのいずれも未指定の場合に発生します。
400 parameter error: start_time: not datetime format : [value] start_timeが日時形式でない場合に発生します。
400 parameter error: start_time: an invalid datetime: [value] start_timeが無効な日時の場合に発生します。
400 parameter error: start_time: ['goal_time', 'first_operation', 'last_operation'] must not be present with 'start_time' start_timeとgoal_time・first_operation・last_operationを同時に指定した場合に発生します。
400 parameter error: goal_time: not datetime format : [value] goal_timeが日時形式でない場合に発生します。
400 parameter error: goal_time: an invalid datetime: [value] goal_timeが無効な日時の場合に発生します。
400 parameter error: goal_time: ['start_time', 'first_operation', 'last_operation'] must not be present with 'goal_time' goal_timeとstart_time・first_operation・last_operationを同時に指定した場合に発生します。
400 parameter error: first_operation: an invalid date: [value] first_operationが無効な日付形式の場合に発生します。
400 parameter error: first_operation: not date format : [value] first_operationが日付形式でない場合に発生します。
400 parameter error: first_operation: ['start_time', 'goal_time', 'last_operation'] must not be present with 'first_operation' first_operationと他の時刻パラメータを同時に指定した場合に発生します。
400 parameter error: last_operation: an invalid date: [value] last_operationが無効な日付形式の場合に発生します。
400 parameter error: last_operation: not date format : [value] last_operationが日付形式でない場合に発生します。
400 parameter error: last_operation: ['start_time', 'goal_time', 'first_operation'] must not be present with 'last_operation' last_operationと他の時刻パラメータを同時に指定した場合に発生します。
400 parameter error: via: not json format : [value] viaがJSON形式でない場合に発生します。
400 parameter error: via: ['use_car'] must not be present with 'via' viaとuse_carを同時に指定した場合に発生します。
400 parameter error: via_type: unallowed value [value] via_typeが無効な値の場合に発生します。
400 parameter error: via_type: field 'via' is required via_typeを指定したがviaが未指定の場合に発生します。
400 parameter error: unuse: an invalid item: unuseに無効な値が含まれる場合に発生します。
400 parameter error: walk_route: an invalid item: walk_routeに無効な値が含まれる場合に発生します。
400 parameter error: walk_route: ['walk_speed'] must not be present with 'walk_route' walk_routeとwalk_speedを同時に指定した場合に発生します。
400 parameter error: order: unallowed value [value] orderが無効な値の場合に発生します。
400 parameter error: commuter_pass: not json format : [value] commuter_passがJSON形式でない場合に発生します。
400 parameter error: term: min value is 1 termが1未満の場合に発生します。
400 parameter error: term: max value is 2880 termが2880を超える場合に発生します。
400 parameter error: walk_speed: min value is 3.0 walk_speedが3.0未満の場合に発生します。
400 parameter error: walk_speed: max value is 8.0 walk_speedが8.0を超える場合に発生します。
400 parameter error: walk_speed: ['walk_route'] must not be present with 'walk_speed' walk_speedとwalk_routeを同時に指定した場合に発生します。
400 parameter error: bicycle_speed: min value is 5 bicycle_speedが5未満の場合に発生します。
400 parameter error: bicycle_speed: max value is 132 bicycle_speedが132を超える場合に発生します。
400 parameter error: bicycle_speed: no definitions validate bicycle_speedをuse_share_cycleなしで指定した場合に発生します。
400 parameter error: bicycle_condition: unallowed value [value] bicycle_conditionが無効な値の場合に発生します。
400 parameter error: bicycle_condition: no definitions validate bicycle_conditionをuse_share_cycleなしで指定した場合に発生します。
400 parameter error: special_pass: an invalid item: special_passに無効な値が含まれる場合に発生します。
400 parameter error: avoid_node: an invalid code: [value] avoid_nodeに無効な交通拠点IDが含まれる場合に発生します。
400 parameter error: use_car: unallowed value [value] use_carが無効な値の場合に発生します。
400 parameter error: use_car: ['via'] must not be present with 'use_car' use_carとviaを同時に指定した場合に発生します。
400 parameter error: unuse_turnback: unallowed value [value] unuse_turnbackが無効な値の場合に発生します。
400 parameter error: limit: min value is 1 limitが1未満の場合に発生します。
400 parameter error: limit: max value is 10 limitが10を超える場合に発生します。
400 parameter error: train_data: unallowed value [value] train_dataが無効な値の場合に発生します。
400 parameter error: bus_data: unallowed value [value] bus_dataが無効な値の場合に発生します。
400 parameter error: options: unallowed value [value] optionsが無効な値の場合に発生します。
400 parameter error: format: unallowed value [value] formatが無効な値の場合に発生します。
400 parameter error: shape_color: unallowed value [value] shape_colorが無効な値の場合に発生します。
400 parameter error: use_section: not json format : [value] use_sectionがJSON形式でない場合に発生します。
400 parameter error: datum: unallowed value [value] datumが無効な値の場合に発生します。
400 parameter error: coord_unit: unallowed value [value] coord_unitが無効な値の場合に発生します。
400 parameter error: use_share_cycle: unallowed value [value] use_share_cycleが無効な値の場合に発生します。
400 parameter error: bound_section: not json format : [value] bound_sectionがJSON形式でない場合に発生します。
400 parameter error: move_priority: unallowed value [value] move_priorityが無効な値の場合に発生します。
400 invalid point param avoid_nodeで指定した駅がstart・goal・viaに含まれている場合に発生します。
400 bad usage on this contract : special_pass must be used with train_data special_pass使用時に必要なオプションが設定されていない場合に発生します。
400 start and goal are both multiple. startとgoalの両方がリスト形式の場合に発生します。
400 coordinate or node is required start/goal/viaのJSON内にnode・lat・lonのいずれも含まれていない場合に発生します。
400 invalid list size start/goalのリスト要素数が0または10を超える場合に発生します。
400 list item must be coordinate or node 多対一検索時にリスト内にspotが含まれている場合に発生します。
400 parameter error: node: an invalid code: [value] start/goal/viaのJSON内のnodeが無効な交通拠点IDの場合に発生します。
400 parameter error: lat: an invalid latitude: [value] start/goal/viaのJSON内のlatが無効な緯度の場合に発生します。
400 parameter error: lat: depends on these values: start/goal/viaのJSON内でlatのみ指定しlonが未指定の場合に発生します。
400 parameter error: lon: an invalid longitude: [value] start/goal/viaのJSON内のlonが無効な経度の場合に発生します。
400 parameter error: lon: depends on these values: start/goal/viaのJSON内でlonのみ指定しlatが未指定の場合に発生します。
400 parameter error: spot: depends on these values: start/goalのJSON内でspotを指定したがlat/lonが未指定の場合に発生します。
400 commuter_pass must be in array format commuter_passがリスト形式でない場合に発生します。
400 list size is too small commuter_passのリストが空の場合に発生します。
400 list size is too large commuter_passのリストが10を超える場合またはvia地点数が上限を超える場合に発生します。
400 avoid_step and avoid_escalator can not use with commuter_pass commuter_pass使用時にwalk_routeにavoid_stepまたはavoid_escalatorが指定された場合に発生します。
400 parameter error: start: required field commuter_pass内のstartが未指定の場合に発生します。
400 parameter error: start: an invalid code: [value] commuter_pass内のstartが無効な交通拠点IDの場合に発生します。
400 parameter error: goal: required field commuter_pass内のgoalが未指定の場合に発生します。
400 parameter error: goal: an invalid code: [value] commuter_pass内のgoalが無効な交通拠点IDの場合に発生します。
400 parameter error: link: required field commuter_pass内のlinkが未指定の場合に発生します。
400 parameter error: link: an invalid code: [value] commuter_pass内のlinkが無効な交通拠点IDの場合に発生します。
400 parameter error: direction: unallowed value [value] commuter_pass内のdirectionが無効な値の場合に発生します。
400 direction required. 環状線の路線で上下区分が未指定の場合に発生します。
400 via must be in json format viaのJSONパースに失敗した場合に発生します。
400 via must be in array format viaがリスト形式でない場合に発生します。
400 goal or start is multiple via使用時にstart/goalがリスト形式の場合に発生します。
400 parameter error: stay-time: min value is 0 viaのJSON内のstay-timeが0未満の場合に発生します。
400 parameter error: stay-time: max value is 300 viaのJSON内のstay-timeが300を超える場合に発生します。
400 use_share_cycle can not use use_share_cycle=true指定時にシェアサイクル設定がない場合に発生します。
400 bicycle_condition or bicycle_speed can not use use_share_cycle/use_rental_cycle=false指定時にbicycle_conditionまたはbicycle_speedを指定した場合に発生します。
400 bad usage on this contract : first_operation and last_operation must be used with timetable 始発・終発検索時に時刻表が未使用の場合に発生します。
400 use_section is invalid use_sectionがdict形式でない場合に発生します。
400 parameter error: start: required field use_section内のstartが未指定の場合に発生します。
400 parameter error: start: an invalid code: [value] use_section内のstartが無効な交通拠点IDの場合に発生します。
400 parameter error: goal: required field use_section内のgoalが未指定の場合に発生します。
400 parameter error: goal: an invalid code: [value] use_section内のgoalが無効な交通拠点IDの場合に発生します。
400 parameter error: operation: required field use_section内のoperationが未指定の場合に発生します。
400 bad usage on this contract : use_section must be used with train data use_section使用時に必要なオプションが設定されていない場合に発生します。
400 bad usage on this contract : bus_data bus_data=timetable指定時に必要なオプションが設定されていない場合に発生します。
400 bad usage on this contract : train_data train_data=timetable指定時に必要なオプションが設定されていない場合に発生します。
400 bad usage on this contract : bus_data, train_data bus_dataとtrain_dataの両方をtimetable指定時に必要なオプションが設定されていない場合に発生します。
400 bad usage on this contract : unuse_link unuse_link使用時にunuse_sectionが設定されている場合に発生します。
400 bound_section can not use with multiple start or multiple goal bound_section使用時にstart/goalがリスト形式の場合に発生します。