GetRoutePointToPoint

指定した任意の2地点間でリンク長の合計が最短となるルートを検索してリンクをすべて取得します。
開始地点と終了地点の最寄りリンクを結ぶルート情報を、パーマネントID一覧および GeoJSON 形式で取得できます。

💰 課金に関する注意事項

本APIは利用方法により課金額が大きくなる可能性があります。

  • 経路探索の長距離指定 起終点間の距離が長いほど、経路上のリンク数が増加しデータ量が増大する

詳細は課金額が大きくなる可能性のあるケースとAPIを参照してください。

リクエスト

項目 内容
HTTPメソッド POST および GET
エンドポイント /API/Route/GetRoutePointToPoint
認証 トークンベース認証(HTTPヘッダに Token-Key を設定)

パラメータ

id 必須 説明 備考
road_classification integer - 道路区分 詳細は road_classification を参照
road_types string - 道路種別 詳細は road_types を参照
request_crs string - リクエスト座標参照系 詳細は CRS を参照
response_crs string - レスポンス座標参照系 詳細は CRS を参照
point1_x double 開始地点 緯度(X座標) 開始地点の緯度、またはX座標(測量座標、南北方向)
point1_y double 開始地点 経度(Y座標) 開始地点の経度、またはY座標(測量座標、東西方向)
point1_z double - 開始地点 高さ(Z座標) 未指定時:0
point2_x double 終了地点 緯度(X座標) 終了地点の緯度、またはX座標(測量座標、南北方向)
point2_y double 終了地点 経度(Y座標) 終了地点の経度、またはY座標(測量座標、東西方向)
point2_z double - 終了地点 高さ(Z座標) 未指定時:0
response_geodata string - geo_data応答形式 詳細は response_geodata を参照
search_type integer - 検索方法 0:地方区切り / 1:全国。未指定時:地方区切り
sp_ep_route integer - 始点終点までの経路 0:検索(追加)しない / 1:検索(追加)する。未指定時:0
補足

本 API は、開始地点と終了地点の2点を指定して最短ルートを探索するAPIです。 sp_ep_route を指定すると、始点側・終点側の補助ルート情報も取得できます。

サンプルソースコード

以下は JavaScript を用いて、本 API を呼び出す例です。
指定した2地点間の最短ルートを検索し、ルートを構成するリンク情報を取得します。

JavaScript
const url = "https://pf.drm.jp/API/Route/GetRoutePointToPoint"; const token = "your_token"; const data = { road_classification: 1, road_types: "1,2,3", request_crs: "EPSG:4326", response_crs: "EPSG:4326", point1_x: 35.681236, point1_y: 139.767125, point1_z: 0, point2_x: 35.689487, point2_y: 139.691706, point2_z: 0, response_geodata: "geojson/object", search_type: 0, sp_ep_route: 0 }; async function callGetRoutePointToPoint() { try { const payload = new URLSearchParams(data); const res = await fetch(url, { method: "POST", headers: { "Token-Key": token, "Content-Type": "application/x-www-form-urlencoded" }, body: payload.toString() }); const json = await res.json(); console.log(JSON.stringify(json, null, 2)); } catch (err) { console.error(err); } }

レスポンス

検索条件に一致したルート情報が JSON 形式で返却されます。
geo_data は、指定した応答形式に応じて文字列またはオブジェクトで返却されます。

JSON
{ "status": 1, "response_crs": "EPSG:4326", "point1_x": 35.681200, "point1_y": 139.767100, "point1_z": 0, "point2_x": 35.689480, "point2_y": 139.691700, "point2_z": 0, "pid_list": "12345678901234567890,22345678901234567890", "geo_data": { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "EPSG:4326" } }, "features": [ { "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ [139.767100, 35.681200, 0], [139.770000, 35.682000, 0] ] }, "properties": { "pid": "12345678901234567890", "版番号": "3703.00", "リンク番号": "5339466789053394667891" } }, { "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ [139.770000, 35.682000, 0], [139.691700, 35.689480, 0] ] }, "properties": { "pid": "22345678901234567890", "版番号": "3703.00", "リンク番号": "5339466789053394667892" } } ] }, "point1_x2": null, "point1_y2": null, "point1_z2": null, "point2_x2": null, "point2_y2": null, "point2_z2": null, "pid_list2": "", "geo_data2": null, "point1_x3": null, "point1_y3": null, "point1_z3": null, "point2_x3": null, "point2_y3": null, "point2_z3": null, "pid_list3": "", "geo_data3": null }
補足

sp_ep_route が 0 の場合、v10.0 追加項目である point1_x2geo_data3null または空文字になります。

レスポンス情報

キー 必須 説明 備考
status integer 処理結果 詳細は status を参照
response_crs string 測地系 レスポンス座標の測地系(EPSG:4326 等)
point1_x double 開始交点 緯度(X座標) 開始指定地点からの最短距離線と最寄りリンクの交点
point1_y double 開始交点 経度(Y座標) 開始指定地点からの最短距離線と最寄りリンクの交点
point1_z double 開始交点 高さ(Z座標) 開始指定地点からの最短距離線と最寄りリンクの交点
point2_x double 終了交点 緯度(X座標) 終了指定地点からの最短距離線と最寄りリンクの交点
point2_y double 終了交点 経度(Y座標) 終了指定地点からの最短距離線と最寄りリンクの交点
point2_z double 終了交点 高さ(Z座標) 終了指定地点からの最短距離線と最寄りリンクの交点
pid_list string パーマネントIDリスト 検索結果(ルート)のパーマネントID(カンマ区切り)
geo_data string / object 地物情報 検索結果(ルート)の GeoJSON
type string - GeoJSON種別 "FeatureCollection" 固定
features[] object[] - Feature配列 ルートを構成するラインの配列
pid string - パーマネントID 当該ラインに対応するリンクのパーマネントID
版番号 string - 版番号+履歴番号 版番号+履歴番号
リンク番号 string - リンク番号 当該ラインに対応するリンクのリンク番号
point1_x2 ~ geo_data2 double / string / object 【始点ルート】追加情報 v10.0追加。sp_ep_route=0 の場合は null または空文字
point1_x3 ~ geo_data3 double / string / object 【終点ルート】追加情報 v10.0追加。sp_ep_route=0 の場合は null または空文字

ステータスコード

コード ステータス 説明
200 OK リクエストが成功しました。
400 Bad Request リクエストが不正です。
401 Unauthorized 認証情報が不正です。
403 Forbidden 権限がありません。
500 Internal Server Error サーバー内部でエラーが発生しました。