[postgis-users] Computation of quantiles in Polygon-Raster

Nick Ves vesnikos at gmail.com
Mon May 4 12:52:50 PDT 2015


Hi list,

I am trying to calculate the quantiles of a (tiled) raster which is
bound by a polygon but I am stumbled.  I can calculate a desired
quantile over a rid using ST_Quantile like so:

SELECT b.rid, q.*
FROM raster.polygon a, raster.sat1 b,
LATERAL
st_quantile(st_clip(b.rast,a.geom),ARRAY[0.25,0.75]) q ORDER BY quantile;

(sample result)

rid quantile value
11 0,25 90
78 0,25 90
40 0,25 78
79 0,25 74
21 0,25 104
80 0,25 74
41 0,25 57
....
13 0,75 152
14 0,75 98
15 0,75 93
16 0,75 98
17 0,75 93
18 0,75 0
19 0,75 172
20 0,75 177
...

but i don't know how to aggregate the results to create a
representative result for the whole dataset.

Anyone has any hint for me on how to proceed ?

N


More information about the postgis-users mailing list