[GIS] Why does Ogr2Ogr Postgres import fail

gdalogrogr2ogrpostgispostgresql

I have a lot of S57 files that need to be imported to PostgresDB. The process takes over 2 hours. In order to improve performance, I have tried using PG_USE_COPY to use copy instead of DB inserts. I am however getting the following error.

Using: GDAL 1.9.1

Env set for:

SET PGCLIENTENCODING=LATIN1

SET PG_USE_COPY=YES

Command: ogr2ogr -update -append -f "PostgreSQL" PG:"dbname='ENCTest'
host='127.0.0.1' port='5432' user='postgres' password='postgres'"
*.000

1/959 Processing file: US1AK90M.000 1492KB Warning 1: Attributes
Radar ignored, not in expected schema. No more warnings will be issued
for this dataset.

ERROR 1: COPY statement failed.

ERROR: malformed array literal: "{"02260892A1C50F"

CONTEXT: COPY bcnspp, line 1, column lnam_refs: "{"02260892A1C50F"

Best Answer

I seemed to have fixed this issue. I upgraded to GDAL 1.9.2, upgraded to Postgres 9.3 and did this on Python 2.7. I also configured the PATH variable to use GDAL ahead of Postgres as there is a GDAL version under postgres (postgis raster support).

This seemed to do the job. I am able to use COPY and retained the Client Encoding to LATIN1.

Related Question