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


##########
common/src/main/java/org/apache/sedona/common/Functions.java:
##########
@@ -1094,6 +1094,48 @@ public static Geometry lineInterpolatePoint(Geometry 
geom, double fraction) {
     return geom.getFactory().createPoint(interPoint);
   }
 
+  public static double perimeter(Geometry geometry, boolean use_spheroid, 
boolean lenient) {
+    if (use_spheroid && geometry.getSRID() != 4326) {
+      if (lenient) {
+        return 0;
+      } else {
+        throw new IllegalArgumentException(
+            "For spheroidal perimeter calculations, the input geometry must be 
in the WGS84 CRS (SRID 4326).");
+      }
+    }
+
+    String geomType = geometry.getGeometryType();
+    if (geomType.equalsIgnoreCase(Geometry.TYPENAME_POLYGON)) {
+      return calculateLength(geometry, use_spheroid);
+    } else if (geomType.equalsIgnoreCase(Geometry.TYPENAME_MULTIPOLYGON)) {
+      return calculateLength(geometry, use_spheroid);
+    } else if 
(geomType.equalsIgnoreCase(Geometry.TYPENAME_GEOMETRYCOLLECTION)) {

Review Comment:
   Wow. I didn't notice that. Let's fix all functions then.



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