[postgis-users] How compute the stats from a raster table.
Sandro Santilli
strk at keybit.net
Fri Mar 16 01:25:51 PDT 2012
On Fri, Mar 16, 2012 at 08:17:14AM +0100, Andrea Peri wrote:
> >ST_SummaryStats()
>
> Hi Pierre,
>
> I try it ,
> but i'm not sure to understand the results.
SELECT (ST_SummaryStats(..)).* FROM ...
Should show you "labels" to better understand.
> If yes, this mean it is returning the stats for every tile.
>
> And so my quest now is how to retrieve the total stat for all the raster table.
I guess you could run aggregates on the single columns of the stats, like:
WITH stats AS ( SELECT (ST_SummaryStats(..)).* FROM ... )
SELECT sum(count) as count, sum(sum) ... FROM stats;
I guess it could be useful to define an aggregate taking
"SummaryStats" type in input so you could do something like:
SELECT (ST_SummaryStatsAgg(ST_SummaryStats(xx))).* FROM myrast;
--strk;
,------o-.
| __/ | Delivering high quality PostGIS 2.0 !
| / 2.0 | http://strk.keybit.net - http://vizzuality.com
`-o------'
More information about the postgis-users
mailing list