See this tutorial:

http://trac.osgeo.org/postgis/wiki/WKTRasterTutorial01

search for "Intersecting the caribou buffers with the elevation rasters"

the query look like this:

CREATE TABLE resulttable AS
 SELECT id,
        (gv).geom AS the_geom,
        (gv).val
 FROM (SELECT id,
              ST_Intersection(rast, the_geom) AS gv
       FROM yourrastertable,
            yourpolygontable
       WHERE ST_Intersects(rast, the_geom)
      ) foo;

Then you have to summarize the results like this:

CREATE TABLE finalresult AS
 SELECT id,
        sum(ST_Area(the_geom) * val) /
        sum(ST_Area(the_geom))) AS meanelev
 FROM resulttable
 GROUP BY id
 ORDER BY id;

>-----Original Message-----
>From: [email protected] [mailto:postgis-users-
>[email protected]] On Behalf Of AJ7
>Sent: 14 mars 2011 13:13
>To: [email protected]
>Subject: [postgis-users] postgis raster : getting pixel value
>
>
>Hi,
>Is it possible to get the pixel value(s) out of the raster image once its
>been exported to postgis raster?
>
>Basically what I want to do is find the pixel values for all the pixels that
>intersect with a different polygon.
>
>Not sure if ST_value will help do that.
>tahnks
>--
>View this message in context: 
>http://old.nabble.com/postgis-raster-%3A-getting-pixel-value-
>tp31146394p31146394.html
>Sent from the PostGIS - User mailing list archive at Nabble.com.
>
>_______________________________________________
>postgis-users mailing list
>[email protected]
>http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to