> Can you please let me know how I can do this? So I did the make empty raster > -> > map algebra -> pixel as polygons approach! > Since there is no dependency on data now, is it possible for you to maybe > outline the steps you performed at your end to get this working? > MapAlgebra needed 2 rasters, so I inputted the same raster twice. So please
There is a one raster version of ST_MapAlgebraExpr(). That's the one to use.... > --SELECT (md).* > --FROM (SELECT ST_MetaData(rast) As md > -- FROM (select ST_MakeEmptyRaster( 8, 4, 8.07734039737749, > 57.7505109647578, 0.000036,0.000036,0,0, 4326 ) rast) foo) foo2; > > > create table vector_grid as > select (ST_PixelAsPolygons(rastfin)).geom , (ST_PixelAsPolygons(rastfin)).val > from ( select ST_MapAlgebraExpr(rast, rast, '([rast.x] - 1) * ' || > ST_Width(rast)::text || ' + [rast.y]' ) rastfin from (select > ST_MakeEmptyRaster( 8, > 4, 8.07734039737749, 57.7505109647578, 0.000036,0.000036,0,0, 4326 ) rast) > foo) foo2; If you want to assign the index values to the raster: SELECT ST_MapAlgebraExpr(ST_MakeEmptyRaster(8, 4, 8.07734039737749, 57.7505109647578, 0.000036,0.000036,0,0, 4326 ), '32BUI', '([rast.x] - 1) * 8 + [rast.y]'::text) If you are happy with the polygons: SELECT (gvxy).geom, ((gvxy).x - 1) + (gvxy).y cellid FROM (SELECT ST_PixelAsPolygons(ST_MakeEmptyRaster(8, 4, 8.07734039737749, 57.7505109647578, 0.000036,0.000036,0,0, 4326 )) gvxy) foo Pierre _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users