Skip to content

Add SQL/MM CircularString (GeoTools-style, locationtech master) - #1232

Open
grootstebozewolf wants to merge 1 commit into
locationtech:masterfrom
grootstebozewolf:locationtech-master
Open

grootstebozewolf wants to merge 1 commit into
locationtech:masterfrom
grootstebozewolf:locationtech-master

Conversation

@grootstebozewolf

Copy link
Copy Markdown
Contributor

Summary

Adds a first-class SQL/MM CircularString to JTS, following the approach Jody outlined on jts-dev in 2019: subclass LineString, keep the 3-control-point windows, linearize on demand. Not “flatten to LineString at parse time”.

This is a small, isolated land on current locationtech/jts master (9c995e53). It does not touch OverlayNG, noding, or SegmentString.

2019 thread:

Behaviour

  • Control points are the stored sequence. Odd count ≥ 3, or empty.
  • Chained windows (start, mid, end); end of window N is start of N+1.
  • Collinear / degenerate windows become an exact chord, not a huge circle.
  • CIRCULARSTRING(s, m, s) is the circle with diameter s–m.
  • getLength() / envelope use the composed arcs (radius * sweep, or chord length).
  • Densify only via toLinear(tolerance) (linearize / getLinearized are aliases).
  • WKT read/write emits control points, not the linearized polyline.
  • SegmentString stays linear.

Each window is an ExactCircularArc behind a thin ExactCurve with six methods only: getStart(), getEnd(), length(), pointAt(t), toLinear(tolerance), isExact(). No other curve kinds.

Out of scope (on purpose)

CompoundCurve, CurvePolygon, WKB, OverlayNG, ArcNoder / non-linear SegmentString.

Tests

cd modules/core
mvn test -Dtest=CircularStringTest,ExactCircularArcTest,CircularStringShelfATest,WKTReadWriteTest

Includes WKT round-trip, closed ring, collinear degrade, tolerance growth, and a pinned quarter-circle CIRCULARSTRING (5 0, 3 4, 0 5) with length 5 * π/2.

mvn -pl modules/core checkstyle:check is clean. New files: author Jeroen Bloemscheer; AI assistance disclosed in a second comment after the EPL/EDL header.

Ask

Is this the right grain for upstream (type + WKT only), or would you rather see WKB in the same PR?

@cursor
cursor Bot force-pushed the locationtech-master branch from 82b0725 to 1d2fea9 Compare September 16, 2026 06:33
CircularString is a real JTS geometry based on locationtech/jts master.
It stores chained 3-point control windows and composes ExactCircularArc
for each window. Collinear windows degrade to a chord. length() and
envelope stay exact; densify only via toLinear / getLinearized / linearize.

WKTReader/WKTWriter support CIRCULARSTRING using control points.
SegmentString is unchanged. No CompoundCurve, OverlayNG, or Year-2 Exact* types.

Assisted-by: Cursor Agent
Assisted-by: xAI Grok

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant