Database Reference
In-Depth Information
SELECT rid, (ST_BandMetadata(rast, 1)).*
FROM prism
WHERE rid = 550;
Theresultsindicatethatthebandisofpixeltype 32BSI andhasa NODATA valueof
-9999 . The NODATA value is the value assigned to an empty pixel.
rid | pixeltype | nodatavalue | isoutdb | path
-----+-----------+-------------+---------+------
550 | 32BSI | -9999 | f |
Now,todosomethingabitmoreuseful,runsomebasicstatisticalfunctionsonthis
raster tile.
First, let's compute the summary statistics (count, mean, standard deviation, min,
and max) with ST_SummaryStats() .
WITH stats AS ( SELECT
(ST_SummaryStats(rast, 1)).* FROM prism WHERE
rid = 550
)
SELECT count, sum, round(mean::numeric, 2)
AS mean, round(stddev::numeric, 2) AS stddev,
min, max
FROM stats;
The output of the preceding code will be as follows:
count | sum | mean | stddev | min | max
-------+---------+---------+--------+-----+------
7081 | 8987349 | 1269.22 | 125.87 | 943 | 1798
Inthesummarystatistics,thecountindicatesthattherastertileisabout30percent
NODATA .Butwhatisreallyinterestingisthatthemean,min,andmaxvaluesdonot
makesenseforminimumtemperaturevalues.We'lldiscussthisissueattheendof
this recipe.
Search WWH ::




Custom Search