Opened 3 years ago

Closed 3 years ago

#1101 closed defect (fixed)

Negative buffer does not return empty geometry

Reported by: uclaros Owned by: mdavis
Priority: major Milestone: 3.9.2
Component: Default Version: 3.9.0
Severity: Unassigned Keywords:
Cc:

Description

In specific cases of 4 sided polygons, running a specific negative buffer erroneously returns a polygon instead of an empty geometry. In shapely:

from shapely import wkt
p=wkt.loads('POLYGON ((646990.625 5344959.438, 646994.486 5344963.053, 646999.7389999999 5344957.423, 646995.9157765866 5344952.851883921, 646990.625 5344959.438))')
p.buffer(-4.2,0)
# does not return empty
p.buffer(-3.2,0)
# correctly returns empty

Change History (7)

comment:1 by mdavis, 3 years ago

This is an issue in JTS as well (see JTS 472). It seems to be a long-standing problem (which is good and bad - I was worried it might have been a result of the change in efe09d6/git).

The problem is caused by the generated buffer curve "flipping inside out". Unfortunately I don't have a idea of what a fix might be at the moment.

Last edited 3 years ago by mdavis (previous) (diff)

comment:2 by komzpa, 3 years ago

For dumb ideas, negative buffer of -N for a ring of perimeter P will eat area of N*P so if area of ring is smaller it will always disappear. Math not proven.

comment:3 by mdavis, 3 years ago

To refine that idea a bit, for a given area A the shape with the largest distance to the boundary is a circle. So the radius of the circle of area A is a lower bound on the negative buffer distance which will cause a shape to be eroded completely. This is a good optimization to add to the buffer code, and it might prevent this sort of issue, in large part.

comment:4 by mdavis, 3 years ago

Fixed in JTS by JTS-706.

Fixed in GEOS by 733bddf948.

Will backport to GEOS 3.9 and 3.8.

comment:5 by mdavis, 3 years ago

Owner: changed from geos-devel@… to mdavis
Status: newassigned

comment:6 by mdavis, 3 years ago

Backported to 3.9 and 3.8.

comment:7 by mdavis, 3 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.