ST_Quantile — 计算样本或总体上下文中栅格或栅格表覆盖范围的分位数。 因此,可以检查某个值是否位于栅格的 25%、50%、75% 百分位处。
SETOF record ST_Quantile(
raster rast, integer nband=1, boolean exclude_nodata_value=true, double precision[] quantiles=NULL)
;
SETOF record ST_Quantile(
raster rast, double precision[] quantiles)
;
SETOF record ST_Quantile(
raster rast, integer nband, double precision[] quantiles)
;
double precision ST_Quantile(
raster rast, double precision quantile)
;
double precision ST_Quantile(
raster rast, boolean exclude_nodata_value, double precision quantile=NULL)
;
double precision ST_Quantile(
raster rast, integer nband, double precision quantile)
;
double precision ST_Quantile(
raster rast, integer nband, boolean exclude_nodata_value, double precision quantile)
;
double precision ST_Quantile(
raster rast, integer nband, double precision quantile)
;
计算样本或总体上下文中栅格或栅格表覆盖范围的分位数。 因此,可以检查某个值是否位于栅格的 25%、50%、75% 百分位处。
如果 |
更改:3.1.0 删除了 ST_Quantile(table_name, column_name) 变体。
可用性: 2.0.0
UPDATE dummy_rast SET rast = ST_SetBandNoDataValue(rast,249) WHERE rid=2; --Example will consider only pixels of band 1 that are not 249 and in named quantiles -- SELECT (pvq).* FROM (SELECT ST_Quantile(rast, ARRAY[0.25,0.75]) As pvq FROM dummy_rast WHERE rid=2) As foo ORDER BY (pvq).quantile; quantile | value ----------+------- 0.25 | 253 0.75 | 254 SELECT ST_Quantile(rast, 0.75) As value FROM dummy_rast WHERE rid=2; value ------ 254
--real live example. Quantile of all pixels in band 2 intersecting a geometry SELECT rid, (ST_Quantile(rast,2)).* As pvc FROM o_4_boston WHERE ST_Intersects(rast, ST_GeomFromText('POLYGON((224486 892151,224486 892200,224706 892200,224706 892151,224486 892151))',26986) ) ORDER BY value, quantile,rid ; rid | quantile | value -----+----------+------- 1 | 0 | 0 2 | 0 | 0 14 | 0 | 1 15 | 0 | 2 14 | 0.25 | 37 1 | 0.25 | 42 15 | 0.25 | 47 2 | 0.25 | 50 14 | 0.5 | 56 1 | 0.5 | 64 15 | 0.5 | 66 2 | 0.5 | 77 14 | 0.75 | 81 15 | 0.75 | 87 1 | 0.75 | 94 2 | 0.75 | 106 14 | 1 | 199 1 | 1 | 244 2 | 1 | 255 15 | 1 | 255