#741 closed defect (fixed)
[PATCH] GEOSSimplify() returns empty polygon if inner ring dimension < simplify distance
Reported by: | rouault | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 3.6.1 |
Component: | Default | Version: | main |
Severity: | Unassigned | Keywords: | |
Cc: | sebastic@… |
Description
Demonstrated with OGR scripting, but the issue is in GEOS
from osgeo import ogr ogr_geom = ogr.CreateGeometryFromWkt('POLYGON ((-180 90,180 90,180 -90,180 -90,-180 -90,-180 90),(0 0,0 0.0001,0.0001 0.0001,0 0))') simple_geom = ogr_geom.Simplify(0.005) print simple_geom # prints POLYGON EMPTY --> unexpected ogr_geom = ogr.CreateGeometryFromWkt('POLYGON ((-180 90,180 90,180 -90,180 -90,-180 -90,-180 90),(0 0,0 0.0001,0.0001 0.0001,0 0))') simple_geom = ogr_geom.Simplify(0.00005) # prints POLYGON ((-180 90,180 90,180 -90,-180 -90,-180 90),(0 0,0.0001 0.0001,0.0 0.0001,0 0)) --> OK
The above is an artificial example reproducing a real world situation
It seems to be an issue failed simplification of the inner ring.
Reproduced with latest GEOS trunk r4082
Attachments (1)
Change History (18)
comment:1 by , 9 years ago
comment:3 by , 9 years ago
Summary: | GEOSSimplify() returns empty polygon if inner ring dimension < simplify distance → [PATCH] GEOSSimplify() returns empty polygon if inner ring dimension < simplify distance |
---|
Attached a patch + new test step that fixes the issue
comment:13 by , 7 years ago
Replying to strk:
Done in trunk and 3.6 branch (for 3.6.1) - thanks
Can the change also be included in the 3.5 branch?
comment:14 by , 7 years ago
Cc: | added |
---|
comment:15 by , 7 years ago
Could you prepare a patch for that ? Can be a pull request for the git repository (official hoster or any mirror).
Note:
See TracTickets
for help on using tickets.
When stepping through GEOS, the "Geometry::AutoPtr roughGeom(GeometryTransformer::transformMultiPolygon(geom, parent));" at line 149 of DouglasPeuckerSimplifier.cpp returns a collection of a linearring (OK) and a linestring (OK ???). Then createValidArea() and the underlying buffer(0) returns an empty polygon (line 395 of BufferBuilder.cpp)