locationtech / locationtech/jts
Weird GeometryFixer behavior
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 475
- Avg merge
- 14d 10h
- Merged PRs (30d)
- 1
Description
So, first of all, let me begin by acknowledging all of your hard work and effort in maintaining this library. Amazing stuff 👏
To the point, it seems GeometryFixer algorithm can sometimes return... unexpected results.
Here are two examples:
| Input | PostGIS ST_MakeValid Result | Geometry Fixer Result (keepCollapsed=false) | Geometry Fixer Result (keepCollapsed=true) |
|---|---|---|---|
POLYGON((0 0, 1 1, 1 2, 1 1, 0 0)) |
MULTILINESTRING((0 0,1 1),(1 1,1 2)) |
POLYGON EMPTY |
LINESTRING (0 0, 1 1, 1 2, 1 1, 0 0) |
POLYGON((0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 2 8, 8 8, 8 2, 2 2), (3 3, 3 7, 7 7, 7 3, 3 3)) |
MULTIPOLYGON(((10 10,10 0,0 0,0 10,10 10),(8 8,2 8,2 2,8 2,8 8)),((7 7,7 3,3 3,3 7,7 7))) |
POLYGON ((0 10, 10 10, 10 0, 0 0, 0 10), (2 2, 8 2, 8 8, 2 8, 2 2) |
POLYGON ((0 10, 10 10, 10 0, 0 0, 0 10), (2 2, 8 2, 8 8, 2 8, 2 2) |
In the first row, it decides to return an empty polygon instead of a line/multiline.
In the second case, it completely discards one of the interior rings.
I'm willing to dive in and provide PRs, assuming you'll confirm these are in fact, bugs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two WKT examples against GeometryFixer with keepCollapsed set to both values, then compare the results with the documented PostGIS ST_MakeValid outputs. The issue does not name source files or tests; done means the handling of collapsed geometry and nested interior rings is confirmed as intended or corrected with regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100