Skip to content

Fix spurious holes in buffers of closed lines - #728

Open
xkenmon wants to merge 3 commits into
peterstace:masterfrom
xkenmon:fix-closed-line-buffer-hole
Open

xkenmon wants to merge 3 commits into
peterstace:masterfrom
xkenmon:fix-closed-line-buffer-hole

Conversation

@xkenmon

@xkenmon xkenmon commented Nov 24, 2026

Copy link
Copy Markdown

Description

A positive buffer of a closed LineString can retain an inverted inward offset as a hole. The result can pass geometry validation while failing to cover the input line.

This ports the hole erosion check from JTS #1117. It reuses the existing triangle and envelope checks and skips generating the inward offset when it would be fully eroded.

Author Motivation

The bug surfaced in downstream use of geom.Buffer on a small closed LineString. The regression uses the public example from GEOS #1223.

Verification

The regression reproduced the spurious hole and loss of coverage in both orientations on master. With the fix, the result covers the input in both orientations and still retains the expected hole at a smaller buffer distance.

  • Added regression tests and updated the changelog.
  • Passed go test ./geom ./carto ./rtree ./internal/jtsport/... -count=1.
  • No benchmark run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant