locationtech / locationtech/jts

Small buffer of a polygon returns an empty geometry

Open
#908 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type-bug
Dominant language
Java
Stars
2.2k
Forks
475
Avg merge
14d 10h
Merged PRs (30d)
1

Description

I'm working with a precision model with a fixed scale of 10000. When doing a buffer operation of +-0.001 sometimes it returns an empty geometry when it isn't the correct result.

I have replicated a couple of them in the JTS Test Builder from the 1.19.0 release, setting it to the precision model I use in code.

"POLYGON ((-1.1261 35.3205, 77.1866 37.8173, 78.3127 2.4968, 0 0, -1.1261 35.3205))"
Doing the default buffer of -0.001 returns an empty geometry.
image

"POLYGON ((28.3065 22.0679, 33.2298 29.772, 49.9274 19.1013, 45.0042 11.3973, 28.3065 22.0679))"
Doing a buffer of 0.001 with the bevel join returns an empty geometry
image

I have not had this issue using values of over 0.01 in absolute value or using a finer grid size.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the JTS Test Builder from the 1.19.0 release using a fixed precision scale of 10000 and the two polygons in the report. Test buffers of ±0.001, including the bevel join case, and compare them with larger values or a finer grid; done means these valid operations no longer incorrectly return empty geometries.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.