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


##########
docs/api/flink/Function.md:
##########
@@ -1694,6 +1694,26 @@ Output:
 POINT (51.5974135047432 76.5974135047432)
 ```
 
+## ST_LineLocatePoint
+
+Introduction: Returns a double between 0 and 1, representing the location of 
the closest point on the LineString as a fraction of its total length.
+The first argument must be a LINESTRING, and the second argument is a POINT 
geometry.
+
+Format: `ST_LineLocatePoint(linestring: Geometry, point: Geometry)`
+
+Since: `v1.5.1`
+
+Spark SQL Example:

Review Comment:
   Not `Spark SQL`. It is `SQL`



##########
flink/src/test/java/org/apache/sedona/flink/FunctionTest.java:
##########
@@ -771,12 +779,6 @@ public void testRemovePointWithIndex() {
         assertEquals("LINESTRING (0 0, 2 2)", 
first(pointTable).getField(0).toString());
     }
 
-    @Test

Review Comment:
   Why remove this test?



##########
common/src/test/java/org/apache/sedona/common/FunctionsTest.java:
##########
@@ -1864,4 +1864,24 @@ public void voronoiPolygons() {
         Geometry actual5 = FunctionsGeoTools.voronoiPolygons(null, 0, null);
         assertEquals(null, actual5);
     }
+
+    @Test
+    public void lineLocatePoint() {
+        LineString lineString = 
GEOMETRY_FACTORY.createLineString(coordArray(0, 0, 1, 1, 2, 2));
+        Geometry point1 = GEOMETRY_FACTORY.createPoint(new Coordinate(-1, 1));
+        Geometry point2 = GEOMETRY_FACTORY.createPoint(new Coordinate(0, 2));
+        Geometry point3 = GEOMETRY_FACTORY.createPoint(new Coordinate(1, 3));
+
+        Double actual1 = Functions.lineLocatePoint(lineString, point1);
+        Double actual2 = Functions.lineLocatePoint(lineString, point2);
+        Double actual3 = Functions.lineLocatePoint(lineString, point3);
+
+        Double expectedResult1 = 0.0;
+        Double expectedResult2 = 0.5;
+        Double expectedResult3 = 1.0;
+
+        assertEquals(expectedResult1, actual1, 0.1);

Review Comment:
   I believe our TestBase already has a variable called `FP Tolerance`



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