You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by ji...@apache.org on 2026/08/25 22:58:12 UTC

(sedona) branch master updated: [GH-3276] Stop straight skeleton from flooding stderr on rasterised outlines (#3285)

This is an automated email from the ASF dual-hosted git repository.

jiayuasu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new 25840b3805b [GH-3276] Stop straight skeleton from flooding stderr on rasterised outlines (#3285)
25840b3805b is described below

commit 25840b3805b547f03e4fde8584ae5a0540d3443e
Author: Jia Yu <ji...@apache.org>
AuthorDate: Tue Aug 25 15:58:06 2026 -0700

    [GH-3276] Stop straight skeleton from flooding stderr on rasterised outlines (#3285)
---
 .../apache/sedona/common/StraightSkeletonTest.java | 42 ++++++++++++++++++++++
 .../ST_ApproximateMedialAxis.md                    |  2 ++
 .../Geometry-Processing/ST_StraightSkeleton.md     |  2 ++
 .../ST_ApproximateMedialAxis.md                    |  2 ++
 .../Geometry-Processing/ST_StraightSkeleton.md     |  2 ++
 .../ST_ApproximateMedialAxis.md                    |  2 ++
 .../sql/Geometry-Processing/ST_StraightSkeleton.md |  2 ++
 pom.xml                                            |  2 +-
 8 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/common/src/test/java/org/apache/sedona/common/StraightSkeletonTest.java b/common/src/test/java/org/apache/sedona/common/StraightSkeletonTest.java
index fdf6e9a6e52..f006fed7e9d 100644
--- a/common/src/test/java/org/apache/sedona/common/StraightSkeletonTest.java
+++ b/common/src/test/java/org/apache/sedona/common/StraightSkeletonTest.java
@@ -20,6 +20,8 @@ package org.apache.sedona.common;
 
 import static org.junit.Assert.*;
 
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
 import org.junit.Test;
 import org.locationtech.jts.geom.Geometry;
 import org.locationtech.jts.geom.LineString;
@@ -438,4 +440,44 @@ public class StraightSkeletonTest {
     // Use relaxed validation since complex road networks may have precision issues
     testPolygon("Complex Branching Road Network", complexRoad, 71, false);
   }
+
+  /**
+   * GH-3276: outlines traced from rasterised pixels have many short, near-collinear edges that
+   * trigger degenerate collision events inside campskeleton. The library used to print a stack
+   * trace to stderr for every one of them while still returning a result. A successful call must
+   * write nothing to stderr.
+   *
+   * <p>The polygon is a 10-vertex fragment of the 557-vertex polygon reported in the issue
+   * (EPSG:5070 metres), minimised while preserving the trigger: with campskeleton 0.0.2-20260118
+   * every skeleton computation deterministically prints three "Planes do not intersect at a single
+   * point" stack traces, so the two calls below capture six.
+   */
+  @Test
+  public void rasterizedOutlineWritesNothingToStderr() throws Exception {
+    String wkt =
+        "POLYGON ((472409 1164929, 471811 1164929, 471808.3035137968 1164876.1108762717, "
+            + "471509 1164809, 471749 1164931, 471756.1108762717 1164988.3035137968, "
+            + "471899 1164991, 472591 1165229, 473639 1164631, 473639 1150616.313708499, "
+            + "472409 1164929))";
+    Geometry polygon = Constructors.geomFromWKT(wkt, 5070);
+    assertTrue(polygon.isValid());
+
+    PrintStream originalErr = System.err;
+    ByteArrayOutputStream captured = new ByteArrayOutputStream();
+    Geometry skeleton;
+    Geometry medialAxis;
+    try {
+      System.setErr(new PrintStream(captured, true, "UTF-8"));
+      skeleton = Functions.straightSkeleton(polygon);
+      medialAxis = Functions.approximateMedialAxis(polygon);
+    } finally {
+      System.setErr(originalErr);
+    }
+
+    assertEquals("skeleton computation must not write to stderr", "", captured.toString("UTF-8"));
+    assertTrue(skeleton instanceof MultiLineString);
+    assertTrue(skeleton.getNumGeometries() > 0);
+    assertTrue(medialAxis instanceof MultiLineString);
+    assertTrue(medialAxis.getNumGeometries() > 0);
+  }
 }
diff --git a/docs/api/flink/Geometry-Processing/ST_ApproximateMedialAxis.md b/docs/api/flink/Geometry-Processing/ST_ApproximateMedialAxis.md
index 29c581eedfe..3d19fd90d72 100644
--- a/docs/api/flink/Geometry-Processing/ST_ApproximateMedialAxis.md
+++ b/docs/api/flink/Geometry-Processing/ST_ApproximateMedialAxis.md
@@ -25,6 +25,8 @@ The pruning removes small branches that represent minor penetrations into corner
 
 This function may have significant performance limitations when processing polygons with a very large number of vertices. For very large polygons (e.g., 10,000+ vertices), applying vertex reduction or simplification is essential to achieve practical computation times.
 
+Outlines traced from raster pixels, or pieces cut by `ST_SubDivide`, often contain many short, near-collinear edges. These trigger degenerate events in the skeleton algorithm: the call still returns a result, but the skeleton can be degraded around such edges. Simplifying the input first, for example with `ST_SimplifyPreserveTopology`, avoids this and also reduces computation time.
+
 Format: `ST_ApproximateMedialAxis(geom: Geometry)`
 
 Return type: `Geometry`
diff --git a/docs/api/flink/Geometry-Processing/ST_StraightSkeleton.md b/docs/api/flink/Geometry-Processing/ST_StraightSkeleton.md
index 0b448c596cc..fe01c26e3e5 100644
--- a/docs/api/flink/Geometry-Processing/ST_StraightSkeleton.md
+++ b/docs/api/flink/Geometry-Processing/ST_StraightSkeleton.md
@@ -25,6 +25,8 @@ This function uses the weighted straight skeleton algorithm based on Felkel's ap
 
 This function may have significant performance limitations when processing polygons with a very large number of vertices. For very large polygons (e.g., 10,000+ vertices), applying vertex reduction or simplification is essential to achieve practical computation times.
 
+Outlines traced from raster pixels, or pieces cut by `ST_SubDivide`, often contain many short, near-collinear edges. These trigger degenerate events in the skeleton algorithm: the call still returns a result, but the skeleton can be degraded around such edges. Simplifying the input first, for example with `ST_SimplifyPreserveTopology`, avoids this and also reduces computation time.
+
 Format: `ST_StraightSkeleton(geom: Geometry)`
 
 Return type: `Geometry`
diff --git a/docs/api/snowflake/vector-data/Geometry-Processing/ST_ApproximateMedialAxis.md b/docs/api/snowflake/vector-data/Geometry-Processing/ST_ApproximateMedialAxis.md
index 74f2f0afa2e..4cd6b74d488 100644
--- a/docs/api/snowflake/vector-data/Geometry-Processing/ST_ApproximateMedialAxis.md
+++ b/docs/api/snowflake/vector-data/Geometry-Processing/ST_ApproximateMedialAxis.md
@@ -25,6 +25,8 @@ The pruning removes small branches that represent minor penetrations into corner
 
 This function may have significant performance limitations when processing polygons with a very large number of vertices. For very large polygons (e.g., 10,000+ vertices), applying vertex reduction or simplification is essential to achieve practical computation times.
 
+Outlines traced from raster pixels, or pieces cut by `ST_SubDivide`, often contain many short, near-collinear edges. These trigger degenerate events in the skeleton algorithm: the call still returns a result, but the skeleton can be degraded around such edges. Simplifying the input first, for example with `ST_SimplifyPreserveTopology`, avoids this and also reduces computation time.
+
 Format: `ST_ApproximateMedialAxis(geom: geometry)`
 
 Return type: `Geometry`
diff --git a/docs/api/snowflake/vector-data/Geometry-Processing/ST_StraightSkeleton.md b/docs/api/snowflake/vector-data/Geometry-Processing/ST_StraightSkeleton.md
index b7c0a6a1606..153a2810e6c 100644
--- a/docs/api/snowflake/vector-data/Geometry-Processing/ST_StraightSkeleton.md
+++ b/docs/api/snowflake/vector-data/Geometry-Processing/ST_StraightSkeleton.md
@@ -25,6 +25,8 @@ This function uses the weighted straight skeleton algorithm based on Felkel's ap
 
 This function may have significant performance limitations when processing polygons with a very large number of vertices. For very large polygons (e.g., 10,000+ vertices), applying vertex reduction or simplification is essential to achieve practical computation times.
 
+Outlines traced from raster pixels, or pieces cut by `ST_SubDivide`, often contain many short, near-collinear edges. These trigger degenerate events in the skeleton algorithm: the call still returns a result, but the skeleton can be degraded around such edges. Simplifying the input first, for example with `ST_SimplifyPreserveTopology`, avoids this and also reduces computation time.
+
 Format: `ST_StraightSkeleton(geom: geometry)`
 
 Return type: `Geometry`
diff --git a/docs/api/sql/Geometry-Processing/ST_ApproximateMedialAxis.md b/docs/api/sql/Geometry-Processing/ST_ApproximateMedialAxis.md
index 7c219396692..9ef6def03cb 100644
--- a/docs/api/sql/Geometry-Processing/ST_ApproximateMedialAxis.md
+++ b/docs/api/sql/Geometry-Processing/ST_ApproximateMedialAxis.md
@@ -25,6 +25,8 @@ The pruning removes small branches that represent minor penetrations into corner
 
 This function may have significant performance limitations when processing polygons with a very large number of vertices. For very large polygons (e.g., 10,000+ vertices), applying vertex reduction or simplification is essential to achieve practical computation times.
 
+Outlines traced from raster pixels, or pieces cut by `ST_SubDivide`, often contain many short, near-collinear edges. These trigger degenerate events in the skeleton algorithm: the call still returns a result, but the skeleton can be degraded around such edges. Simplifying the input first, for example with `ST_SimplifyPreserveTopology`, avoids this and also reduces computation time.
+
 Format: `ST_ApproximateMedialAxis(geom: Geometry)`
 
 Return type: `Geometry`
diff --git a/docs/api/sql/Geometry-Processing/ST_StraightSkeleton.md b/docs/api/sql/Geometry-Processing/ST_StraightSkeleton.md
index 8e3d122eb91..2e6d307abdf 100644
--- a/docs/api/sql/Geometry-Processing/ST_StraightSkeleton.md
+++ b/docs/api/sql/Geometry-Processing/ST_StraightSkeleton.md
@@ -25,6 +25,8 @@ This function uses the weighted straight skeleton algorithm based on Felkel's ap
 
 This function may have significant performance limitations when processing polygons with a very large number of vertices. For very large polygons (e.g., 10,000+ vertices), applying vertex reduction or simplification is essential to achieve practical computation times.
 
+Outlines traced from raster pixels, or pieces cut by `ST_SubDivide`, often contain many short, near-collinear edges. These trigger degenerate events in the skeleton algorithm: the call still returns a result, but the skeleton can be degraded around such edges. Simplifying the input first, for example with `ST_SimplifyPreserveTopology`, avoids this and also reduces computation time.
+
 Format: `ST_StraightSkeleton(geom: Geometry)`
 
 Return type: `Geometry`
diff --git a/pom.xml b/pom.xml
index 3f314e32818..60dd981ad34 100644
--- a/pom.xml
+++ b/pom.xml
@@ -381,7 +381,7 @@
             <dependency>
                 <groupId>org.datasyslab</groupId>
                 <artifactId>campskeleton</artifactId>
-                <version>0.0.2-20260118</version>
+                <version>0.0.2-20260823</version>
             </dependency>
             <!-- proj4sedona for CRS transformation (pure Java, no LGPL dependencies) -->
             <dependency>