Opened 14 years ago

Closed 12 years ago

#3753 closed defect (fixed)

Multipolygon with holes from OCI to PostgreSQL becomes invalid

Reported by: Niccolo Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: 1.6.3
Severity: normal Keywords: OCI multipolygon holes
Cc: ilucena

Description

I'm trying to import a table from Oracle to Postgres with ogr2ogr.

Some records seem perfectly valid in Oracle, but become not valid in Postgres ("Holes are nested" error).

One geometry in Oracle is a MULTIPOLYGON with (outer_ring, inner_ring, outer_ring, inner_ring). The same geometry in Postgres becomes a MULTIPOLYGON with (outer_ring, outer_ring, outer_ring, outer_ring).

I attach an ASCII dump of the Oracle geometry.

Attachments (3)

oracle_multipolygon.txt (9.3 KB ) - added by Niccolo 14 years ago.
SDO_ELEM_INFO_ARRAY and SDO_ORDINATE_ARRAY of the Oracle geometry
ogrinfo_BASE_AREE_VERDI_346 (4.7 KB ) - added by Niccolo 14 years ago.
Ogrinfo output of the problematic multipolygon
ogrocilayer.patch (544 bytes ) - added by Nicolas Simon 12 years ago.

Download all attachments as: .zip

Change History (10)

by Niccolo, 14 years ago

Attachment: oracle_multipolygon.txt added

SDO_ELEM_INFO_ARRAY and SDO_ORDINATE_ARRAY of the Oracle geometry

comment:1 by warmerdam, 14 years ago

Cc: ilucena added
Component: defaultOGR_SF

Niccolo,

Can you run ogrinfo to see how OGR sees this geometry? I'm trying to determine if the problem is in the oracle driver or the postgres driver.

by Niccolo, 14 years ago

Attachment: ogrinfo_BASE_AREE_VERDI_346 added

Ogrinfo output of the problematic multipolygon

comment:2 by Niccolo, 14 years ago

Hi Frank, thank you very much for your interest in this.

It seems that ogrinfo gets the wrong geometry too, i.e. a MULTIPOLYGON(ring, ring, ring, ring).

I attach the ogrinfo dump of the problematic record.

comment:3 by warmerdam, 14 years ago

Cc: warmerdam added; ilucena removed
Keywords: Postgres removed
Owner: changed from warmerdam to ilucena

Ivan,

Is this something you may have time to dig into?

comment:4 by ilucena, 14 years ago

Not at the moment.

comment:5 by warmerdam, 14 years ago

Cc: ilucena added; warmerdam removed
Owner: changed from ilucena to warmerdam

This issue will have to wait for someone with oracle experience/access to have time to dig into it. Thanks for reporting it.

by Nicolas Simon, 12 years ago

Attachment: ogrocilayer.patch added

comment:6 by Nicolas Simon, 12 years ago

This error comes from a bad interpretation of inner ring (nEType = 2003). New polygon should be created only if we encounter a new outer ring (nEType = 1003). By replacing the condition (see patch), inner ring is now added to the current polygon.

This patch is relative to trunk, but it can be easily back ported

Nicolas

comment:7 by ilucena, 12 years ago

Resolution: fixed
Status: newclosed

Patch applied on trunk, revision r24521

Note: See TracTickets for help on using tickets.