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

Gerardo Zárate gerardo.zarate.m at gmail.com
Tue Jan 7 12:31:03 PST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140107/5199b53b/attachment.html>


More information about the postgis-users mailing list