I need some help writing the sql for returning the "MEAN" value from a raster(in postgis db) that intersects a defined(inquery) polygon(in postgis db).
The polygon layer is called: public.farmpaddocks The raster layer is called: public.l8_9385_20131118ndvi_vg94 Both are SRID :3111
I have a field in the public.farmpaddocks table that I would like to filter the result on. Field: farmpaddocks.farmid = '511'.
I assume i need to use the ST_Summarystats function? along with intersection and clip ?? This is my first attempt at an intersect. I get no error or result from the pgadmin output pane?? Not sure whats going on.
sql:
SELECT
l8_9385_20131118ndvi_vg94.rast,
farmpaddocks.farmid
FROM
public.l8_9385_20131118ndvi_vg94,
public.farmpaddocks
WHERE
farmpaddocks.farmid='511' AND ST_Intersects(l8_9385_20131118ndvi_vg94.rast,
farmpaddocks.the_geom);