ST_InterpolateRaster

指定以坐标(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;

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}}}