AW: [Gdal-dev] ERROR import Shape to PostgreSQL
Frank Warmerdam
warmerdam at pobox.com
Fri Jan 16 14:45:16 EST 2004
Düster Horst wrote:
> Frank
>
> I got an idea and take a look at the shapes I sent to you with the JUMP QA
> Basic Topology Analysis. The polygon where the mentioned ogr2ogr process
> breaks is a self intersecting polygon. I seems that ogr2ogr 1.1.7.2 works
> fine with this self intersecting features and the latest ogr2ogr not.
Dr. Düster,
It seems there are a few things going on.
The OGR Shapefile reader now has a bunch of code for recognising multipolygons
and returning them accordingly instead of returning them as polygons where
some inner rings are actually outer rings. However, the code that works this
out seems to just produce multipolygons with no components when things are
self-intersecting as in your case.
The second problem is that OGRMultiPolygon::exportToWkt() incorrectly
represents this as "MULTIPOLYGON()" instead of "MULTIPOLYGON(EMPTY)".
So I plan to address both issues, first fixing OGR's WKT processor to
support the empty forms. Second to see if I can make the shapefile reader
at least produce an error, or perhaps return all the rings as a
multipolygon with everything as an outer ring (and a warning).
In the meantime, you can likely construct a attribute query that will
filter this problem polygon out for the transfer.
eg.
ogr2ogr -f postgresql PG:dbname=hdus lieg_lieg_geom.shp -lco overwrite=yes \
-lco launder=yes -lco precision=no -nlt MULTIPOLYGON -nln liegen \
-where 'SYS_OBID != 17869'
Lastly, I seem to be having problems with the overwrite support in the postgis
driver. Something about the relation for the <name>_ogc_fid_seq not being
deleted when layers are deleted. I'll see what I can do about that too.
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 Gdal-dev
mailing list