Opened 6 years ago

Closed 4 years ago

#6789 closed defect (wontfix)

Problematic results from GDALPolygonize on simple raster cases

Reported by: chau Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: GDAL_Raster Version: 2.1.0
Severity: normal Keywords: polygonize
Cc:

Description

Using the polygonising facility of GDAL I have found 4 simple raster cases where the polygonisation leads to two different result:

1) ###   2) ##   3)  ##  4) ###
   # #      # #     # #     # #
   ##       ###     ###      ##

In both case 1 and 2 the result is a single polygon, where in case 3 and 4 the result is a polygon with a hole:

1, Result: POLYGON ((1 4,1 1,3 1,3 2,2 2,2 3,3 3,3 2,4 2,4 4,1 4))

2, Result: POLYGON ((1 4,1 1,4 1,4 3,3 3,3 2,2 2,2 3,3 3,3 4,1 4))

3, Result: POLYGON ((2 4,2 3,1 3,1 1,3 1,4 1,4 4,2 4),(2 3,2 2,3 2,3 3,2 3))

4, Result: POLYGON ((1 4,1 2,2 2,2 1,4 1,4 4,1 4),(2 3,3 3,3 2,2 2,2 3))

The results for 3 and 4 are not valid since the inner ring touches the outer ring. Saving those results to a SHAPE file using OGR results in the holes being converted to new exterior rings thus creating overlapping results.

I would expect all four cases to result in a single polygon without holes.

I have tested the issue in both version 1.11 and 2.1.0 and in both cases the problem occurs.


Combining case 3 and 4 to:

3+4)  ##
     # #
     # #
      ##

seems to produce what I would expect is the correct result, two polygons and no holes.

Another curiosity is the difference in point counts for case 3 and 4. It seems that in case 3 an extra point is added to the bottom line, though it doesn't affect the overall shape.

Change History (1)

comment:1 by Even Rouault, 4 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.