locationtech / locationtech/spatial4j

JtsGeometry.unwrapDateline creates an invalid polygon in some cases

Open
#186 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
961
Forks
172
PR merge metrics
No merged PRs in 30d

Description

Start with this Geometry:
POLYGON ((-180 -24.5271348, -180 0.9447814, 180 0.9447814, 180 -24.5271348, -180 -24.5271348))

Pass it to a JtsGeometry, and when unwrapDateline is called during initialization, it modifies to the following:

POLYGON ((180 -24.5271348, 180 0.9447814, 180 0.9447814, 180 -24.5271348, 180 -24.5271348))

That's not a valid polygon; note that all the -180 longitudes are now 180, so all of those points are on a straight line.

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 with JtsGeometry initialization and the unwrapDateline path, using the WKT polygon in the issue to reproduce the conversion. Done means the example remains a valid polygon after initialization and does not collapse all -180 longitudes to 180.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.