[postgis-users] postgis raster : getting pixel value

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Mon Mar 14 10:16:57 PDT 2011


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: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
>bounces at postgis.refractions.net] On Behalf Of AJ7
>Sent: 14 mars 2011 13:13
>To: postgis-users at postgis.refractions.net
>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
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list