-- then get stats for these clipped regions
b_stats AS
(SELECT building_id, (stats).*
-FROM (SELECT building_id, ST_SummaryStats(ST_Clip(rast,geom,2)) As stats
+FROM (SELECT building_id, ST_SummaryStats(ST_Clip(rast,geom),2) As stats
FROM aerials.boston
INNER JOIN feat
ON ST_Intersects(feat.geom,rast)
ORDER BY building_id;
building_id | num_pixels | min_pval | max_pval | avg_pval
-------------+------------+----------+----------+------------------
- 100 | 1087 | 0 | 252 | 57.5501379944802
- 103 | 655 | 4 | 176 | 65.3145038167939
- 150 | 894 | 0 | 252 | 185.530201342282</programlisting>
+ 100 | 1090 | 1 | 255 | 61.0697247706422
+ 103 | 655 | 7 | 182 | 70.5038167938931
+ 150 | 895 | 2 | 252 | 185.642458100559</programlisting>
</refsection>
<refsection>