[postgis-users] Pixel value/geom

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue Feb 28 10:16:38 PST 2012


> I would like to get the pixel value and geometry without having to group the
> pixels with the same value together as ST_DumpAsPolygons does.
> 
> I my goal is to get pixel values whose center is within a polygon.

SELECT (ST_PixelAsPolygons(ST_Clip(rast, yourpolygon))).val
FROM yourrastertable, yourpolygontable
WHERE ST_Intersects(rast, yourpolygon)

but normally you want to compute some sort of statistic with all those values. In this case you use ST_SummaryStats() instead of PixelAsPolygons().

Pierre



More information about the postgis-users mailing list