You can do: SELECT ST_PixelAsPolygon(rast, ST_WorldToRasterCoordX(rast, ST_X(geom)), ST_WorldToRasterCoordY(rast, ST_Y(geom))) geom FROM yourrast, yourpoints WHERE ST_Intersects(rast, geom)
Note that PixelAsPolygon has no "s". You will get the vectorization of every pixels having a point inside. Up to you to deal with duplicates. Pierre > -----Original Message----- > From: [email protected] [mailto:postgis-users- > [email protected]] On Behalf Of Hugues François > Sent: Friday, April 05, 2013 6:51 AM > To: [email protected] > Subject: [postgis-users] How to perform st_PixelAsPolygon(rast, geom) ? > > Hello, > > > > I need to work with a dem raster at the pixel scale but there are few > functions to > access them. Maybe I forgot something but, if we can have a value crossing a > point with raster using st_value, we can't access the pixel geometry directly > from a point. > > > > The only way I found was first to use St_PixelAsPolygons to access pixel > geometry (for relevant tiles) and then intersects resulting geometries with > original points but this method costs very much. > > > > Anyone have an idea to increase performances ? > > > > Hugues. _______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
