Opened 14 years ago
Closed 14 years ago
#3356 closed defect (fixed)
OGR unreliability when detecting inner rings from outer rings for small polygons with big coordinates
Reported by: | packalen | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.7.1 |
Component: | default | Version: | unspecified |
Severity: | major | Keywords: | multipolygon polygon shapefile |
Cc: | warmerdam, aki.suvanto@… |
Description
Recent releases of GDAL/OGR recognize some multipolygons as polygons. This defect occur only with ESRI Shapefile driver. I have attached an example file which demonstrates this bug. The out.shp contains one multipolygon which is an outcome of intersection by OGR/GEOS. With GDAL 1.4.0.0
ogrinfo -al out.shp
recognizes the geometry correctly as MultiPolygon, but with GDAL 1.7.0b2
ogrinfo -al out.shp
recognizes the geometry incorrectly as Polygon (incorrectly interior ring is outside of exterior ring). The same defect occur both under Windows and Linux.
Petteri
Attachments (1)
Change History (3)
by , 14 years ago
Attachment: | test_data.zip added |
---|
comment:1 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 14 years ago
Cc: | added |
---|---|
Milestone: | → 1.7.1 |
Resolution: | → fixed |
Status: | assigned → closed |
Summary: | MultiPolygon vs. Polygon issue with ESRI Shapefile driver → OGR unreliability when detecting inner rings from outer rings for small polygons with big coordinates |
Note:
See TracTickets
for help on using tickets.
Ok, this turned out to be a very interesting problem. The way to detect inner and outer rings in polygons has changed a lot between GDAL 1.4 and 1.5 (or 1.6). The new code relied on an existing method to detect the winding order (clock wise or counter clock wise) which was subject to numerical instabilities with polygons that have a small area, but big coordinates, which is the case in your sample. As it also turned out that this algorithm was derived from the getArea() method, getArea() was wrongly returning 0 in that case.
The fix is the following :
Fixed in trunk in r18674. Tests added in r18675. Backported in 1.7 branch in r18676
Ticket to follow with similar issues (and fix :-)) in shapelib when writing a polygon...