查詢r(jià)aster對(duì)象分位數(shù)的像素值。
前提條件
通過ST_StatsQuantile預(yù)先計(jì)算分位數(shù)。
語法
raster ST_Quantile(raster raster_obj,
float8[] quantiles default NULL,
cstring bands default '',
boolean exclude_nodata_value default true,
out integer band,
out float8 quantile,
out float8 value)
參數(shù)
參數(shù)名稱 | 描述 |
---|---|
raster_obj | raster對(duì)象。 |
quantiles | 需要計(jì)算的分位數(shù),取值為0.25、0.5和0.75中的一個(gè)或多個(gè)。 |
bands | 需要計(jì)算的波段,格式為'0-2' 或者'1,2,3' ,從0開始。 默認(rèn)為'' ,表示裁剪所有的波段。
|
exclude_nodata_value | 是否需要計(jì)算nodata。 |
band | 返回波段號(hào)。 |
quantile | 返回分位數(shù)。 |
value | 返回像素值。 |
示例
-- 計(jì)算所有波段 0.25 分位數(shù)的像素值。
SELECT (ST_Quantile(rast, ARRAY[0.25], '0-2', true)).* FROM rat_quantile WHERE id = 1;
band | quantile | value
------+----------+-------
0 | 0.25 | 11
1 | 0.25 | 10
2 | 0.25 | 50
(3 rows)
-- 計(jì)算0波段所有分位數(shù)的像素值。
SELECT (ST_Quantile(rast, NULL, '0', true)).* FROM rat_quantile WHERE id = 1;
band | quantile | value
------+----------+-------
0 | 0.25 | 11
0 | 0.5 | 11
0 | 0.75 | 65
(3 rows)