furqaankhan commented on code in PR #1527:
URL: https://github.com/apache/sedona/pull/1527#discussion_r1686979835


##########
common/src/main/java/org/apache/sedona/common/Functions.java:
##########
@@ -90,6 +93,57 @@ public static Geometry boundary(Geometry geometry) {
     return boundary;
   }
 
+  public static Geometry expand(Geometry geometry, double uniformDelta) {
+    return expand(geometry, uniformDelta, uniformDelta, uniformDelta);
+  }
+
+  public static Geometry expand(Geometry geometry, double deltaX, double 
deltaY) {
+    return expand(geometry, deltaX, deltaY, 0);
+  }
+
+  public static Geometry expand(Geometry geometry, double deltaX, double 
deltaY, double deltaZ) {
+    if (geometry == null || geometry.isEmpty()) {
+      return geometry;
+    }
+
+    Coordinate[] coordinates = geometry.getCoordinates();
+    double minX = Double.MAX_VALUE;
+    double maxX = -Double.MAX_VALUE;
+    double minY = Double.MAX_VALUE;
+    double maxY = -Double.MAX_VALUE;
+    double minZ = Double.MAX_VALUE;
+    double maxZ = -Double.MAX_VALUE;
+
+    for (int i = 0; i < coordinates.length; i++) {
+      minX = Math.min(minX, coordinates[i].x);
+      maxX = Math.max(maxX, coordinates[i].x);
+      minY = Math.min(minY, coordinates[i].y);
+      maxY = Math.max(maxY, coordinates[i].y);
+      minZ = Math.min(minZ, coordinates[i].z);
+      maxZ = Math.max(maxZ, coordinates[i].z);

Review Comment:
   Yeah, it just returns a NaN, and I am skipping the Z values when Geometry 
doesn't have it. I don't see it being a problem. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to