[FWTools] import problems shp -> postgres using ogr2ogr

Frank Warmerdam warmerdam at pobox.com
Wed Jan 4 11:27:14 EST 2006


On 1/4/06, christian.michels at eifelgeist.com
<christian.michels at eifelgeist.com> wrote:
> 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 !

Christian,

I would appreciate it if you could file a bug on this issue.

But I think you can workaround the issue by specifying the "-nlt GEOMETRY"
option on the ogr2ogr commandline.

I believe the problem is that the shapefile is identified as type POLYGON
but has some multi-island polygons which translate as MULTIPOLYGON.
Ogr2ogr creates the table with the geometry type polygon, but multipolygon
is not compatible with that and as of PostGIS 1.0 geometry type is
strictly enforced.

The fix is for OGR's Shapefile driver to always return the
layer type as GEOMETRY for polygon files since we can't
know if they are all polygon, all multipolygon or a mix of
the two.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the FWTools mailing list