1
votes

I have been trying to import my SRTM raster data into my postgis using the command, but has generated the following error (tried multiple times). Is there any thing missing? I appreciate for any help

Error message:

ERROR: relation "test" already exists
ERROR: current transaction is aborted, commands ignored until end of transaction block

enter image description here

1
Please do not post images of textual material. Replace the image with a copy and paste of the error messages. The error(where relation = table) is telling you what the problem is and this raster2pgsql provides the answer.Adrian Klaver

1 Answers

1
votes

Welcome to SO.

The error message says you're trying to create a relation that already exists. Either drop it in your database ..

DROP TABLE test;

.. or tell raster2pgsql to do it for your by adding the parameter -d to your command.

-d Drops the table, then recreates it and populates

Something like

raster2pgsql -I -z 10x10 -C -F -s 4326 file.hgt -d public.test | psql ...

An alterative is to use -a to append the data to an existing table

-a Appends raster into current table, must be exactly the same table schema.