[postgis-users] Insert st_pixelaspolygons output into new table

Sandro Santilli strk at keybit.net
Wed Apr 4 09:02:39 PDT 2012


On Wed, Apr 04, 2012 at 07:38:00PM +0400, Gis Mage wrote:
> Hi list!
> 
> I want to create a table of points, representing every pixel in
> another raster table.
> For that I plan to use st_centroid of every square polygon returned by
> st_pixelaspolygons.
> 
> The problem is that st_pixelaspolygon returns set of records, which I
> can't insert into new table, or create table as output from this
> function.
> I need to extract geom and val or some kind of wrapper - I'm really
> stuck here - never worked with record type in postgres.

 WITH records AS ( SELECT (ST_PizelAsPolygons(rast)).* FROM mytable )
 SELECT geom,val FROM records;

--strk;

  ,------o-. 
  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com
  `-o------'




More information about the postgis-users mailing list