ST_SummaryStatsAgg — 聚合。返回由一组栅格的给定栅格波段的COUNT、SUM、Mean、STDDEV、MIN、MAX组成的摘要统计信息。假定带区1未指定带区。
summarystats
ST_SummaryStatsAgg
(
raster
rast
, integer
nband
, boolean
exclude_nodata_value
, double precision
sample_percent
)
;
summarystats
ST_SummaryStatsAgg
(
raster
rast
, boolean
exclude_nodata_value
, double precision
sample_percent
)
;
summarystats
ST_SummaryStatsAgg
(
raster
rast
, integer
nband
, boolean
exclude_nodata_value
)
;
退货
摘要统计信息
由一个或多个栅格覆盖的给定栅格波段的COUNT、SUM、Mean、STDDEV、MIN、MAX组成。如果未指定波段
nband
默认为1。
![]() |
|
默认情况下只考虑像素值不等于
|
![]() |
|
默认情况下,将对所有像素进行采样。要获得更快的响应,请设置
|
可用性:2.2.0
WITH foo AS (
SELECT
rast.rast
FROM (
SELECT ST_SetValue(
ST_SetValue(
ST_SetValue(
ST_AddBand(
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
, 1, '64BF', 0, 0
)
, 1, 1, 1, -10
)
, 1, 5, 4, 0
)
, 1, 5, 5, 3.14159
) AS rast
) AS rast
FULL JOIN (
SELECT generate_series(1, 10) AS id
) AS id
ON 1 = 1
)
SELECT
(stats).count,
round((stats).sum::numeric, 3),
round((stats).mean::numeric, 3),
round((stats).stddev::numeric, 3),
round((stats).min::numeric, 3),
round((stats).max::numeric, 3)
FROM (
SELECT
ST_SummaryStatsAgg(rast, 1, TRUE, 1) AS stats
FROM foo
) bar;
count | round | round | round | round | round
-------+---------+--------+-------+---------+-------
20 | -68.584 | -3.429 | 6.571 | -10.000 | 3.142
(1 row)