[gdal-dev] Invalid geometry reading from Oracle via OGR OCI driver

Even Rouault even.rouault at mines-paris.org
Thu Sep 9 13:35:29 EDT 2010


Niccolo,

I can't comment on the OCI side, but I can explain a bit what happens at the 
shapefile side. In shapefiles, the only way to distinguish holes from non-holes  
is based on the winding : clockwise for non-holes (outer ring), 
counterclockwise for holes (inner ring). So the shapefile writer makes a 
topological analysis of all the rings of the multipolygon to fix their winding 
if needed. The shapefile reader also does a similar analysis to rebuild the 
geometry. 

If you still replicate the issue in the OCI driver with the latest version, it 
might be appropriate to file a ticket in Trac with a way to reproduce it.

Best regards,

Even

Le jeudi 09 septembre 2010 15:44:47, Niccolo Rigacci a écrit :
> In an Oracle Spatial DB I have a geometry like this:
> 
> MULTIPOLYGON = (((POLYGON), (HOLE)), ((POLYGON), (HOLE)))
> 
> When I dump the geometry via ogrinfo, I get an invalid geometry:
> 
> MULTIPOLYGON = (((POLYGON)), ((POLYGON)), ((POLYGON)), ((POLYGON)))
> 
> The dump is done with:
> ogrinfo "OCI:..." table_name
> 
> The same problem results when I import the Oracle geometry into a
> Postgres database via ogr2ogr. The resulting geometry is invalid.
> 
> Strange enough, if I convert the same Oracle geometry into a
> shapefile, the result IS valid: two polygons with one hole
> each. The conversion is made with:
> ogr2ogr -f "ESRI Shapefile" shapefile "OCI:..."
> 
> I noticed also that the polygons into the shapefile are
> clock-wise inverted respect the original Oracle ones, but the
> geometry is valid.
> 
> 
> I'm using GDAL/OGR 1.6.3.
> 
> Am I missing some OGR parameter?
> Is this a known bug fixed in newer versions?
> 
> Thank you very much for any hints.


More information about the gdal-dev mailing list