[postgis-users] Copy raster data to other tables in PostGIS

Bborie Park dustymugs at gmail.com
Tue Jan 7 12:52:42 PST 2014


Remove the ST_MakeEmptyRaster() from your INSERT statement.

-bborie


On Tue, Jan 7, 2014 at 12:31 PM, Gerardo Zárate
<gerardo.zarate.m at gmail.com>wrote:

> I'm experimenting with rater in PostGIS 2.1.1. I manage to load a raster
> file into a table using raster2pgsql in Windows 7. I loaded the raster file
> into a single row of the table and displayed in QGIS 1.8 and QGIS 2.0.
>
> What I'm trying to accomplish is a table with multiple raster files like
> the following example:
>
> CREATE TABLE public.dummy_raster
> (
>   rid integer NOT NULL,
>   rast1 raster,
>   rast2 raster,
>   CONSTRAINT dummy_raster_pkey PRIMARY KEY (rid)
> );
>
> I tried to copy the raster column of the table created by raster2pgsql to
> my dummy table using the following code.
>
> INSERT INTO dummy_raster (rid, rast1)
> SELECT 1, ST_MakeEmptyRaster(rast)
>   FROM rastertest WHERE rid = 1;
>
> UPDATE dummy_raster SET rast1 = (SELECT ST_AsRaster(NULL,p.rast) FROM
> rastertest p WHERE p.rid=1) WHERE rid=1;
> COMMIT;
>
> Both statements were executed successfully but when I try to import the
> raster data into QGIS nothing is displayed.
>
> Is this the correct way to copy raster data from one column to other or is
> there a better way to do this?
>
> Best regards,
>
> Gerardo Zárate
>
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140107/52ba7352/attachment.html>


More information about the postgis-users mailing list