Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4710 closed defect (invalid)

Copying a shapefile layer to PostGIS fails

Reported by: PaulFMichell Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords: CopyLayer AddGeometryColumn PostGIS 2.0
Cc:

Description

Whilst using GDAL to copy a shapefile into a new table on a PostGIS 2.0 server with the following code:

OutputOGRDataSource := OGROpen(PChar('...'), 0, Nil);

InputOGRDataSource := OGROpen(PChar(InputFileName), 0, Nil);

OGRLayer := OGR_DS_GetLayer(InputOGRDataSource, 0);

OGR_DS_CopyLayer(OutputOGRDataSource, OGRLayer, PChar('test'), OutputOptions);

The program fails with an error on the CopyLayer command of:

ERROR 1: AddGeometryColumn failed for layer test, layer creation has failed.

I also tried the same import using the QGIS Spit add-in which failed with:

The database gave an error while executing this SQL: SELECT AddGeometryColumn('public','Highways_Structures2','the_geom',-1,'MULTIPOLYGON',2) The error was: ERROR: function addgeometrycolumn(unknown, unknown, unknown, integer, unknown, integer) is not unique LINE 1: SELECT AddGeometryColumn('public','Highways_Structures2','th...

I am assuming this is the same problem. We are using GDAL SVN from 13/06/2012.

Change History (2)

comment:1 by Even Rouault, 12 years ago

Resolution: invalid
Status: newclosed

I conclude from the above description that this is not a GDAL problem, but probably something related to your PostGIS installation. Perhaps worth asking to postgis-user mailing list ?

comment:2 by PaulFMichell, 12 years ago

OK, thanks for looking at it.

Note: See TracTickets for help on using tickets.