locationtech / locationtech/jts

OverlayNG difference operation moves points in outer edge

Open
#1,222 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Stepping through the code the change in point locations occurs in GeometryOverlay in the JTS code base. isOverLayNG is set to true so OverlayNGRobust.overlay is used. The two input geometries are:

POLYGON ((412023.08 92158.29, 412021.68 92161.6, 412022.58 92161.96, 412021.45 
92164.58, 412022.19 92165.38, 412021.43 92167.13, 412018.32 92165.86, 412016.28 
92165.03, 412019.75 92156.92, 412023.08 92158.29))

and a negative (-0.5m) buffer of it:

POLYGON ((412022.4 92158.6, 412020 92157.6, 412016.9 92164.8, 412021.2 92166.5, 
412021.6 92165.5, 412021.1 92164.9, 412021 92164.8, 412021 92164.7, 412021 
92164.6, 412021 92164.5, 412021 92164.4, 412021.9 92162.2, 412021.5 92162.1, 
412021.4 92162, 412021.3 92162, 412021.3 92161.9, 412021.2 92161.8, 412021.2 
92161.7, 412021.2 92161.6, 412021.2 92161.5, 412021.2 92161.4, 412022.4 
92158.6))

are differenced to give a bordered polygon. which results in:

POLYGON ((412019.8 92156.9, 412016.3 92165, 412018.3 92165.9, 412021.4 92167.1, 
412022.2 92165.4, 412021.5 92164.6, 412022.6 92162, 412021.7 92161.6, 412023.1 
92158.3, 412019.8 92156.9), (412021.2 92161.4, 412021.2 92161.5, 412021.2 
92161.6, 412021.2 92161.7, 412021.2 92161.8, 412021.3 92161.9, 412021.3 92162, 
412021.4 92162, 412021.5 92162.1, 412021.9 92162.2, 412021 92164.4, 412021 
92164.5, 412021 92164.6, 412021 92164.7, 412021 92164.8, 412021.1 92164.9, 
412021.6 92165.5, 412021.2 92166.5, 412016.9 92164.8, 412020 92157.6, 412022.4 
92158.6, 412021.2 92161.4))

Some of the points in the outer polygon are moved for no reason.

Image

Reverting to isOverlayNG=false solves this issue.

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

Start in GeometryOverlay, where isOverLayNG selects OverlayNGRobust.overlay, and reproduce the difference using the two polygon inputs in the issue. Compare the OverlayNG result with the isOverlayNG=false result, focusing on the changed outer-ring coordinates. The fix is complete when OverlayNG preserves the unaffected outer points while still producing the bordered polygon.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.