[postgis-users] ST_AsRaster vs raster2pgsql

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue Mar 4 10:08:45 PST 2014


It's not because the entries in raster_columns are different that the actual tables are different. Info in raster_columns is generated from constraints set by raster2pgsql. A better way to compare the two tables is to use ST_Metadata() and ST_BandMetadata().

You can also set the constraints on the second table using AddRasterConstraints(). Then have a look at raster_columns.

Pierre

> -----Original Message-----
> From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-
> bounces at lists.osgeo.org] On Behalf Of georgew
> Sent: Tuesday, March 04, 2014 12:51 PM
> To: postgis-users at lists.osgeo.org
> Subject: [postgis-users] ST_AsRaster vs raster2pgsql
> 
> Hi, I am new to raster and am having some problems creating a raster table
> from a contour vector table, PostGIS 2.1.1, Win 8.1 64bit
> 
> To create the table I am using:
> 
> CREATE TABLE BK30_dem2 AS
>   SELECT 1 AS rid, ST_AsRaster((
>        SELECT
>           ST_Collect(geom)
>        FROM contours_topo_2 where sheet='BK30'
>        ), 5.0, 5.0 )
>   AS rast;
> 
> For comparison purpose I also created a grid from the same contours using
> SAGA GIS, then created a second raster table in PostGIS using:
> 
>  raster2pgsql -I -C -s 2193 I:\dems\pg-50k-grid\BK30\BK30_dem2.sdat
> public.bk30_saga | psql -d NZTPU;
> 
>  I was hoping for identical results but the output from Raster Columns
> shows
> the following:
> 
> 
> "NZTPU";"public";"bk30_saga";"rast";2193;5;-
> 5;4801;5784;TRUE;FALSE;1;"{32BF}";"{-
> 99999}";"{f}";"010300002091080000010000000500000000000080DD0F3
> A41CECF067D3C72554100000080A26D3A41CECF067D3C7255410000008
> 0A26D3A41CECF067DFE55554100000080DD0F3A41CECF067DFE5555410
> 0000080DD0F3A41CECF067D3C725541"
> 
> "NZTPU";"public";"bk30_dem2";"rast";0;;;;;FALSE;FALSE;;"";"";"";""
> 
> Clearly I am doing something wrong, but what??
> Many thanks for any help.
> 
> 
> 
> --
> View this message in context: http://postgis.17.x6.nabble.com/ST-
> AsRaster-vs-raster2pgsql-tp5005827.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list