このトピックでは、ST_InterpolateRaster関数について説明します。 この関数は、3Dポイントのセットと補間条件に基づいてラスターオブジェクトを補間し、補間結果を新しいラスターオブジェクトとして返します。 3D点は (x,y,z) の形式で表される。
構文
raster ST_InterpolateRaster(
geometry input_points,
integer width,
integer height,
cstring interpolateOptions,
cstring storageOptions);パラメーター
パラメーター | 説明 |
input_points | 補間ポイントのセット。 |
width | ラスタデータの列数。 |
height | ラスタデータの行数。 |
interpolateOptions | 空間補間アルゴリズムに関する情報を記述するJSON文字列。 |
storageOption | ラスターオブジェクトを格納するチャンクを記述するJSON文字列。 |
次の表に、interpolateOptionsパラメーターのフィールドを示します。
フィールド | 説明 | データ型 | デフォルト値 | 設定 |
method | 補間方法。 | String | IDW | IDW補間のみがサポートされています。 |
radius | 検索半径。 | double | 0.0 | このフィールドの値が0の場合、検索半径は入力点の数と面積に基づいて計算されます。 |
power | 補間重み。 | double | 2.0 | なし。 |
max_points | ポイントの最大数。 | integer | 10 | ポイントの最大数は、min_pointsフィールドの値より大きくなければなりません。 |
min_points | ポイントの最小数。 | integer | 2 | なし。 |
nodata | 空の値。 | double | 0.0 | なし。 |
parallel | 並列処理度 (DOP) 。 | integer | 1 | なし。 |
次の表に、storageOptionパラメーターのフィールドを示します。
フィールド | 説明 | データ型 | Format | デフォルト値 | 説明 |
chunkdim | 各チャンクのサイズ。 | String | (w、h、b) | 元のオブジェクトの各チャンクのサイズと同じ | なし。 |
chunktable | 指定するチャンクテーブルの名前。 | String | なし。 | なし。 | このフィールドが指定されていない場合、一時テーブルが作成されます。 |
celltype | ラスターオブジェクトのピクセルタイプ。 | String | なし。 | 16BUI | ラスタオブジェクトのピクセルタイプ。 有効な値:
|
例
-- The following code provides a common example.
SELECT ST_InterpolateRaster(
st_collect(ST_MakePoint(st_x(geom),st_y(geom),value)),
256,
256,
'{"method":"IDW","radius":"3.0","max_points":"4","min_points":"1"}',
'{"chunktable":"rbt","celltype":"8bui"}')
FROM point_table;
st_interpolateraster
---------------------
{"attributes":{"id":"f54cff0a-cca4-4e51-ac11-7aa5a3c9d9b6","name":"","type":"normal","version":1.1,"storage":{"mode":"internal","location":"rbt","md5":"","endian":"ndr","compress":"lz4","compressQuality":75,"fileSystem":"null","chunking":{"enable":true,"chunkHeight":256,"chunkWidth":256,"chunkBand":1,"rowChunksDimension":1,"columnChunksDimension":1,"bandChunksDimension":1},"cellType":"8bui","interleaving":"bsq"},"description":"","width":256,"height":256,"bands":1,"pyramid":{"resample":"near","level":0,"table":""},"overview":{"table":"","column":"","pyramidLevel":1},"referenceOriginPoint":{"type":"Raster","ulp":{"row":0,"column":0,"band":0},"rrp":{"row":0,"column":0,"band":0},"wrp":{"x":0,"y":0,"z":0}}},"spatialReference":{"valid":true,"srid":0,"refLocation":"center","affline":{"upperleftx":0.0,"upperlefty":2.0,"scalex":0.0078125,"scaley":-0.0078125,"skewx":0.0,"skewy":0.0},"gcps":{"count":0}}}
-- The following code provides an example in which the parallel parameter is specified.
SELECT ST_InterpolateRaster(
st_collect(ST_MakePoint(st_x(geom),st_y(geom),value)),
256,
256,
'{"radius":"2.0","max_points":"4","min_points":"1","parallel":"4"}',
'{"chunktable":"rbt","celltype":"8bui"}')
FROM point_table;
st_interpolateraster
---------------------
{"attributes":{"id":"b769c306-4416-4e31-9e60-d2b847642190","name":"","type":"normal","version":1.1,"storage":{"mode":"internal","location":"rbt","md5":"","endian":"ndr","compress":"lz4","compressQuality":75,"fileSystem":"null","chunking":{"enable":true,"chunkHeight":256,"chunkWidth":256,"chunkBand":1,"rowChunksDimension":1,"columnChunksDimension":1,"bandChunksDimension":1},"cellType":"8bui","interleaving":"bsq"},"description":"","width":256,"height":256,"bands":1,"pyramid":{"resample":"near","level":0,"table":""},"overview":{"table":"","column":"","pyramidLevel":1},"referenceOriginPoint":{"type":"Raster","ulp":{"row":0,"column":0,"band":0},"rrp":{"row":0,"column":0,"band":0},"wrp":{"x":0,"y":0,"z":0}}},"spatialReference":{"valid":true,"srid":0,"refLocation":"center","affline":{"upperleftx":0.0,"upperlefty":2.0,"scalex":0.0078125,"scaley":-0.0078125,"skewx":0.0,"skewy":0.0},"gcps":{"count":0}}}