[FWTools] import problems shp -> postgres using ogr2ogr

christian.michels at eifelgeist.com christian.michels at eifelgeist.com
Wed Jan 4 05:19:16 EST 2006


Hello,

trying to import a polygon shp file into postgres produces the error message below !

C:\Program Files\FWTools1.0.0a7\bin>ogr2ogr -f PostgreSQL -a_srs EPSG:4326 PG:"host=test user=postgres dbname=test" -sql "SELECT id, name from test" D:\data\test.shp
ERROR 1: INSERT command for new feature failed.
ERROR:  new row for relation "test" violates check constraint "enforce_geotype_wkb_geometry"

Command: INSERT INTO "test" (wkb_geometry , "id", "name") VALUES (GeometryFr
omText('MULTIPOLYGON (((-5.349999904632568 33.25,-5.34833288192749 33.2475013732
91016,-5.349705696105957 33.247501373291016,-5.349999904632568 33.25)),((-6.3524
99961853027 32.333610534667969,-6.12166690826416 32.889167785644531,-6.113446235
656738 32.895561218261719,-5.641666889190674 33.247501373291016,-5.3497056961059
57 33.247501373291016,-5.267134666442871 32.540836334228516,-5.22333288192749 32
.161388397216797,-6.352499961853027 32.333610534667969)))'::TEXT,4326) ,
 348, 'MEKNES')
ERROR 1: Terminating translation prematurely after failed
translation from sql statement.

I imported the shp file via shp2pgsql and psql - that works fine !

Since some objects could be imported I think the shp file is may be corrupted ?! I do not really understand what constraint "enforce_geotype_wkb_geometry" checks - Would be great if somebody could help me on that !
By the way - I managed to import some line shp files via ogr2ogr and that worked fine !

Thanx a lot for any help !

cheers

chris


More information about the FWTools mailing list