Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2589 closed defect (fixed)

OGR shape file driver sometimes confuses inner and outer rings

Reported by: asgerpetersen Owned by: warmerdam
Priority: normal Milestone: 1.5.3
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc:

Description

OGR shape file driver sometimes reads a polygon with inner ring as a multipolygon with multiple outer rings. In the attached example there is a polygon with one inner ring. The outer and the inner ring touches at one point. As far as I can see, this is allowed in SF.

ArcGIS reports the feature in the attached file as a polygon with a hole.

OpenJump? also recognizes it as a polygon with a hole (see below).

OGR reports it as a multipolygon with two outer rings (see below).

OpenJump? report:

POLYGON ((565574.53 6147590.48 27.52, 565559.91 6147573.42 27.53, 565539.24
6147591.14 27.54, 565552.04 6147606.07 27.53, 565553.43 6147607.69 27.53, 565557.39 
6147612.31 27.53, 565572.66 6147599.22 27.52, 565569.03 6147594.98 27.52, 565574.53 
6147590.48 27.52), (565569.03 6147594.98 27.52, 565558.55 6147603.95 27.53, 
565557.48 6147602.7 27.96, 565548.62 6147592.37 27.53, 565559.03 6147583.45 27.53, 
565569.03 6147594.98 27.52))

OGR report:

D:\>ogrinfo buildings_410_MultiPoly.shp buildings_410_MultiPoly
INFO: Open of `buildings_410_MultiPoly.shp'
      using driver `ESRI Shapefile' successful.

Layer name: buildings_410_MultiPoly
Geometry: 3D Polygon
Feature Count: 1
Extent: (565539.240000, 6147573.420000) - (565574.530000, 6147612.310000)
Layer SRS WKT:
(unknown)
DSFL_CLASS: String (3.0)
SUBCLASS: String (2.0)
D168: String (7.0)
D169: Real (16.0)
OGRFeature(buildings_410_MultiPoly):0
  DSFL_CLASS (String) = KG4
  SUBCLASS (String) = U1
  D168 (String) = Bygning
  D169 (Real) =          4779148
  MULTIPOLYGON (((565574.53000000003 6147590.4800000004 27.52,565559.91000000003
 6147573.4199999999 27.53,565539.23999999999 6147591.1399999997 27.5399999999999
99,565552.04000000004 6147606.0700000003 27.53,565553.43000000005 6147607.690000
0004 27.53,565557.39000000001 6147612.3099999996 27.53,565572.66000000003 614759
9.2199999997 27.52,565569.03000000003 6147594.9800000004 27.52,565574.5300000000
3 6147590.4800000004 27.52)),((565569.03000000003 6147594.9800000004 27.52,56555
8.55000000005 6147603.9500000002 27.53,565557.47999999998 6147602.7000000002 27.
96,565548.62 6147592.3700000001 27.53,565559.03000000003 6147583.4500000002 27.5
3,565569.03000000003 6147594.9800000004 27.52)))

Attachments (1)

buildings_410_MultiPoly.zip (789 bytes) - added by asgerpetersen 11 years ago.
Example shape file

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by asgerpetersen

Attachment: buildings_410_MultiPoly.zip added

Example shape file

comment:1 Changed 11 years ago by Even Rouault

Milestone: 1.5.3
Resolution: fixed
Status: newclosed

Yes the problem was that the case where the outer and the inner ring touches at one point was not correctly handled.

Fixed in trunk in r15460 (test added in r15461) and in branches/1.5 in r15462

comment:2 Changed 11 years ago by Even Rouault

Correction to handle properly cases for subtle case where 2 parts are touching, one included in the bounding box of the other, but not included (convex polygon) in trunk in r15470 and in branches/1.5 in r15472

Note: See TracTickets for help on using tickets.