指定以座標(x,y,z)
形式表示的點的集合與插值條件進行空間插值操作,並將插值結果作為一個新的Raster對象返回。
文法
raster ST_InterpolateRaster(
geometry input_points,
integer width,
integer height,
cstring interpolateOptions,
cstring storageOptions);
參數
參數名稱 | 描述 |
input_points | 插值點集合。 |
width | 柵格列數。 |
height | 柵格行數。 |
interpolateOptions | 基於JSON格式的字串,描述空間插值演算法的具體資訊。 |
storageOption | 基於JSON格式的字串,描述raster對象分Block Storage資訊。 |
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 | 並行度 | integer | 1 | 無。 |
storageOption支援的參數如下:
參數名稱 | 描述 | 類型 | 格式 | 預設值 | 說明 |
chunkdim | 分塊的維度資訊 | string | (w, h, b) | 從原始影像中讀取分塊大小 | 無 |
chunktable | 寫入chunk_table名稱 | string | 無 | 無 | 如不指定,則建立暫存資料表。 |
celltype | 像素類型 | string | 無 | 16BUI | raster對象的像素類型。 取值範圍:
|
樣本
--一般案例
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}}}
-- 指定parallel
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}}}