緯度経度配列取得
/coords_line [POST]
基本情報
概要
ルート形状を表すGeoJSONをもとに、緯度経度配列を作成します。
作成した緯度経度配列は各APIのcoordsパラメータなどで利用できます。
URL
https://{HOST}/{CID}/v1/coords_line
出力形式
- json
対応言語
- ja
パラメータ
| パラメータ名 | 必須 | 概要 | 型名 | デフォルト値 | 上下限/選択値 | 備考 |
|---|---|---|---|---|---|---|
| max_distance | ✔ | 最大距離(単位:m) | 数値 | 最小:1 最大:300000 |
詳細はこちらをご覧ください | |
| max_point | ✔ | 最大地点数 | 数値 | 最小:2 最大:500 |
詳細はこちらをご覧ください |
max_distance及びmax_pointに関する挙動について
GeoJsonをもとに作成される配列は、常にmax_distance・max_pointで指定した値以内に収まるよう作成されます。
BODYにて指定したGeoJSONがmax_distance・max_pointの値を超える経路を示していた場合、
配列に含まれる地点数、配列が表す経路の総距離がmax_distance・max_pointの値に達した時点で
配列が作成中断・出力されます。
パラメータ構成例
- 最大距離10000m, 最大地点数150地点の配列を作成
/coords_line?max_distance=10000&max_point=150
POST の BODY に含める情報
GeoJSONをBODYに指定してください。 また、指定できるGeoJSONは以下の通りです。
-
GeoJSONオブジェクトのtypeメンバーが以下の値
- FeatureCollection
- LineString
-
ジオメトリオブジェクトのtypeメンバーが以下の値
- LineString
GeoJSONの形式について
BODYに指定するGeoJSONは、基本的に弊社のルート形状取得API・道路形状取得APIで取得できるGeoJSONを想定しています。
GeoJSONオブジェクトのtypeメンバーがFeatureCollectionである場合
featuresオブジェクトに含まれるオブジェクトのtypeメンバは"Feature"となります。
BODYの指定例
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"bbox": [
139.700391,
35.684618,
139.702151,
35.690544
],
"geometry": {
"type": "LineString",
"coordinates": [
[
139.700391,
35.690544
],
[
139.700412,
35.690132
],
[
139.700469,
35.689506
],
[
139.700575,
35.688858
],
[
139.700866,
35.687768
],
[
139.701294,
35.686703
],
[
139.701648,
35.685858
],
[
139.701867,
35.685447
],
[
139.702014,
35.685021
],
[
139.702151,
35.684618
]
]
},
"properties": {
"ways": "transport",
"section": "0001,0002",
"inline": {
"line_style": "solid",
"width": 5,
"color": "#004EFF",
"opacity": 1.0,
"strokelinecap": "round",
"strokelinejoin": "round"
},
"outline": {
"line_style": "solid",
"width": 10,
"color": "#00174C",
"opacity": 1.0,
"strokelinecap": "round",
"strokelinejoin": "round"
},
"transport_type": "railway"
}
},
・・・
],
"bbox": [
139.700391,
35.682222,
139.702173,
35.690544
]
}
レスポンス
| 名称 | レスポンス名 | 型名 | 配列 | Nullable | 説明 |
|---|---|---|---|---|---|
| 配列調整フラグ | is_lack | 真偽値 | 詳細はこちらをご覧ください | ||
| 総距離 | distance | 数値 | 緯度経度配列が示すルート形状の総距離 小数点以下は切り捨てとなります |
||
| 緯度経度配列 | coords | 文字列 | GeoJSONを加工して作成した緯度経度配列 |
is_lackの出力条件
is_lackは「作成した配列が指定したGeoJSONに含まれる地点を網羅できなかった場合」に一律trueとして出力されます。 詳細はこちらをご参照ください。
レスポンス例
{
"distance": 981,
"coords": "[[35.690544,139.700391],[35.690132,139.700412],[35.689506,139.700469],[35.688858,139.700575],[35.687768,139.700866],[35.686703,139.701294],[35.685858,139.701648],[35.685447,139.701867],[35.685021,139.702014],[35.684618,139.702151],[35.682954,139.702092],[35.682958,139.702114],[35.682927,139.702145],[35.682913,139.702162],[35.682851,139.702173],[35.682809,139.702125],[35.682747,139.702085],[35.68274,139.702048],[35.682656,139.701974],[35.68259,139.701921],[35.682553,139.701741],[35.682387,139.701801],[35.682237,139.701852],[35.682222,139.70178]]"
}
エラー情報
エラーハンドリングについて
エラーメッセージは追加/変更/削除されることがあります。
エラーハンドリングされる場合はHTTPステータスコードをもとにご対応ください。
共通エラーについてはこちらをご参照ください。
| HTTPステータス | エラーメッセージ | 発生理由 |
|---|---|---|
| 405 | This http method is invalid : GET (等) | 許可されていないHTTPメソッドでアクセスされた場合に発生します。 |
| 400 | parameter error: max_distance: required field | 必須パラメータである max_distance が指定されていない場合に発生します。 |
| 400 | parameter error: max_distance: ['min value is 1'] または max_distance: ['max value is 300000'] | max_distance に数値以外の文字列を指定した場合や、下限値(1未満)や上限値(300000超過)の範囲外の値を指定した場合に発生します。 |
| 400 | parameter error: max_point: required field | 必須パラメータである max_point が指定されていない場合に発生します。 |
| 400 | parameter error: max_point: ['min value is 2'] または max_point: ['max value is 500'] | max_point に数値以外の文字列を指定した場合や、下限値(2未満)や上限値(500超過)の範囲外の値を指定した場合に発生します。 |
| 400 | body is required | リクエストボディが指定されていない場合に発生します。 |
| 400 | This body is not json format. | リクエストボディが正しいJSON形式ではない、またはJSONオブジェクトではない場合に発生します。 |
| 400 | this geojson can not use. | リクエストボディの type が FeatureCollection でも LineString でもない場合に発生します。 |
| 400 | parameter error: features: required field | type が FeatureCollection のボディに features フィールドが存在しない場合に発生します。 |
| 400 | parameter error: features: ['must be of list type'] | features フィールドがリスト型ではない場合に発生します。 |
| 400 | parameter error: type: required field | features 内の各オブジェクト、または geometry オブジェクトに type フィールドが存在しない場合に発生します。 |
| 400 | parameter error: type: ['unallowed value {value}'] | features 内オブジェクトの type が Feature 以外、または geometry の type が LineString 以外の場合に発生します。 |
| 400 | parameter error: geometry: required field | features 内のオブジェクトに geometry フィールドが存在しない場合に発生します。 |
| 400 | parameter error: geometry: ['must be of dict type'] | geometry フィールドがオブジェクト(dict)型ではない場合に発生します。 |
| 400 | parameter error: coordinates: required field | geometry オブジェクトに coordinates フィールドが存在しない場合に発生します。 |
| 400 | parameter error: coordinates: ['must be of list type'] | coordinates フィールドがリスト型ではない場合に発生します。 |
| 400 | coordinates must be in array format. | coordinates 内の各座標要素がリスト(配列)型ではない場合に発生します。 |
| 400 | list size must be 2 or 3. | coordinates 内の座標配列の要素数が2または3ではない場合に発生します([経度, 緯度] または [経度, 緯度, 高度])。 |
| 400 | parameter error: coord: ['an invalid coordinate : {value}'] | coordinates 内の座標値(緯度・経度)が不正なフォーマットの場合に発生します。 |
| 400 | max_distance is too short. | max_distance による距離カット後に座標が1点以下しか残らない場合に発生します。 |
| 400 | the format of coords is incorrect | 距離計算時に座標値の数値変換に失敗した場合に発生します。 |