指定以坐标(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对象分块存储信息。
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对象的像素类型。
取值范围:
  • 8BSI
  • 8BUI
  • 16BSI
  • 16BUI
  • 32BSI
  • 32BUI
  • 32BF
  • 64BF

示例

--一般案例
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;

-- 指定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;