Opened 17 years ago

Last modified 15 years ago

#1415 closed defect

ogr2ogr/shapefile fails to generate valid polygons with hole touching boundary — at Version 2

Reported by: llo@… Owned by: Mateusz Łoskot
Priority: normal Milestone: 1.4.2
Component: OGR_SF Version: 1.3.2
Severity: normal Keywords: shapefile
Cc: llo@…, warmerdam, Markus Neteler, frederic.claudel@…

Description (last modified by warmerdam)

Using ogr2ogr to generate a shapefile will produce invalid polygons with hole if the hole touches the outer-boundary in one point. It produces a simple polygon without any hole, and ONLY a self-intersecting boundary.

This ONLY applies to shapefiles, no problems found with postgis or tab-file writer.

Example polygon in WKT that cannot be converted to a valid shapefile: POLYGON ((0 0, 0 3, 3 3, 3 0, 0 0), (0 0, 1 2, 2 1, 0 0))

/Regards Lars

Change History (3)

by fredc, 17 years ago

Attachment: shpopen.c added

OGR shapefile patched for touching polygons

comment:1 by fredc, 17 years ago

We (think we) fixed this bug for touching polygons : see attached file shpopen.c, from line 1925 to line 1980.

All polygon pairs were tested for inclusion of its first polygon starting vertex in the other polygon, with a non strict inclusion. So in your case, the outer ring starting vertex was incorrectly considered "inside" the inner ring.

=> the inclusion is now strict in shpopen.c

note : that issue can also appear with outer touching polygons.

comment:2 by warmerdam, 17 years ago

Cc: warmerdam added
Description: modified (diff)
Keywords: shapefile added
Milestone: 1.4.2
Owner: changed from warmerdam to Mateusz Łoskot
Priority: highestnormal
Severity: criticalnormal

Mateusz,

Can you look into this for 1.4.2? Once you are happy with the change, I can upstream it to the shapelib repository.

Note: See TracTickets for help on using tickets.