ST_SummaryStatsAgg — Aggregatfunktion. Gibt eine zusammenfassende Statistik aus, die aus der Anzahl, der Summe, dem arithmetischen Mittel, dem Minimum und dem Maximum der Werte eines bestimmten Bandes eines Rastersatzes besteht. Wenn kein Band angegeben ist, wird Band 1 angenommen.
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);
Gibt summarystats aus, bestehend aus der Anzahl, der Summe, dem arithmetischen Mittel, der Standardabweichung, dem Minimum und dem Maximum der Werte eines Rasterbandes oder eines Rastercoverage. Wenn kein Band angegeben ist, wird Band 1 angenommen.
|
|
|
Standardmäßig werden nur jene Pixelwerte berücksichtigt, die nicht |
|
|
|
Standardmäßig werden alle Pixel abgetastet. Um eine schnellere Rückmeldung zu bekommen, können Sie den Parameter |
Verfügbarkeit: 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)