WKTReader returns Envelope instead of Polygon

Open
#166 8 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing the rectangle WKT case through WKTReader and inspect how the Polygon is represented as an Envelope. Review the existing discussion to determine whether the intended outcome is preserving the Polygon or adding a separate conversion path; completion should include an agreed behavior and tests for the reported case.

Written by the indexing model from the issue text.

Description

enhancement

When supplying a rectangle wktstring (POLYGON ((14 53, 13 53, 13 52, 14 52, 14 53))) to the WKTReader, the WKTReader returns an Envelope (ENVELOPE (13, 14, 53, 52)).

I find this non intuitive, as I would expect it to not change the "shape form". Is there a possibility to

  • prevent the WKTReader from "optimizing" the shape form?
  • or, to change the polygon shape "object" to an envelope shape "object" without readers/writers?

I guess this would also happen with other shapes, e.g., a circle, right?

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

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.

More from locationtech/spatial4j

All issues in locationtech/spatial4j

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.