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

prantogg pushed a commit to branch orient-ccw
in repository https://gitbox.apache.org/repos/asf/sedona-spatialbench.git

commit c822e7f08a3f439ad858694f0e2b7de5e0c330ab
Author: Pranav Toggi <[email protected]>
AuthorDate: Tue Nov 4 16:56:20 2025 -0800

    orient polygons to counter clockwise
---
 Cargo.toml                           |  2 +-
 spatialbench/src/generators.rs       |  2 +-
 spatialbench/src/spatial/geometry.rs | 11 ++++++++---
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 0d419ef..d95e73a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ repository = "https://github.com/apache/sedona-spatialbench/";
 version = "1.1.1"
 
 [workspace.dependencies]
-geo = "0.30.0"
+geo = "0.31.0"
 geozero = { version = "0.14.0", features = ["with-wkb", "with-geo"]}
 
 [profile.release]
diff --git a/spatialbench/src/generators.rs b/spatialbench/src/generators.rs
index b7319e2..5751542 100644
--- a/spatialbench/src/generators.rs
+++ b/spatialbench/src/generators.rs
@@ -1570,6 +1570,6 @@ mod tests {
         // Check first Building
         let first = &buildings[1];
         assert_eq!(first.b_buildingkey, 2);
-        assert_eq!(first.to_string(), "2|blush|POLYGON((124.218033476 
10.538071565,124.215762091 10.536069114,124.214352934 
10.536014944,124.212486371 10.539913704,124.217919324 
10.539075339,124.218033476 10.538071565))|")
+        assert_eq!(first.to_string(), "2|blush|POLYGON((124.218033476 
10.538071565,124.217919324 10.539075339,124.212486371 
10.539913704,124.214352934 10.536014944,124.215762091 
10.536069114,124.218033476 10.538071565))|")
     }
 }
diff --git a/spatialbench/src/spatial/geometry.rs 
b/spatialbench/src/spatial/geometry.rs
index b856585..8d799c3 100644
--- a/spatialbench/src/spatial/geometry.rs
+++ b/spatialbench/src/spatial/geometry.rs
@@ -1,6 +1,7 @@
 use crate::spatial::utils::{apply_affine, round_coordinates};
 use crate::spatial::{GeomType, SpatialConfig};
-use geo::{coord, Geometry, LineString, Point, Polygon};
+use geo::orient::Direction;
+use geo::{coord, Geometry, LineString, Orient, Point, Polygon};
 use rand::rngs::StdRng;
 use rand::Rng;
 use std::f64::consts::PI;
@@ -51,7 +52,9 @@ pub fn generate_box_geom(
         .map(|(x, y)| coord! { x: x, y: y })
         .collect();
 
-    Geometry::Polygon(Polygon::new(LineString::from(coords), vec![]))
+    let mut polygon = Polygon::new(LineString::from(coords), vec![]);
+    polygon = polygon.orient(Direction::Default);
+    Geometry::Polygon(polygon)
 }
 
 pub fn generate_polygon_geom(
@@ -90,5 +93,7 @@ pub fn generate_polygon_geom(
         ring.push(first);
     }
 
-    Geometry::Polygon(Polygon::new(LineString::from(ring), vec![]))
+    let mut polygon = Polygon::new(LineString::from(ring), vec![]);
+    polygon = polygon.orient(Direction::Default);
+    Geometry::Polygon(polygon)
 }

Reply via email to