jiayuasu commented on code in PR #856:
URL: https://github.com/apache/sedona/pull/856#discussion_r1225944319


##########
common/src/main/java/org/apache/sedona/common/utils/GeomUtils.java:
##########
@@ -419,4 +419,23 @@ public static Geometry[] getSubGeometries(Geometry geom) {
         }
         return geometries;
     }
+
+
+    public static Geometry get3DGeom(Geometry geometry, double zValue, boolean 
addDefaultZValue) {
+        Coordinate[] coordinates = geometry.getCoordinates();
+        if (coordinates.length == 0) return geometry;
+
+        boolean is3d = !Double.isNaN(coordinates[0].z);
+        for(int i = 0; i < coordinates.length; i++) {
+            if(!is3d) {
+                if (addDefaultZValue) {

Review Comment:
   The addDefaultZValue is not needed. Please remove the redundant check. It 
can be easily achieve by overloading the force3D function like this:
   
   ```
   public static Geometry force3D(Geometry geometry, double zValue) {
           return GeomUtils.get3DGeom(geometry, zValue);
       }
   
       public static Geometry force3D(Geometry geometry) {
          return GeomUtils.get3DGeom(geometry, 0.0);
       }
   ```



-- 
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