@@ -213,7 +213,16 @@ public static double length(@NonNull MultiPolygon multiPolygon,
213213 return len ;
214214 }
215215
216- private static double length (List <Point > coords , String units ) {
216+ /**
217+ * Takes a {@link List} of {@link Point} and measures its length in the specified units.
218+ *
219+ * @param coords geometry to measure
220+ * @param units one of the units found inside {@link TurfConstants.TurfUnitCriteria}
221+ * @return length of the input line in the units specified
222+ * @see <a href="http://turfjs.org/docs/#linedistance">Turf Line Distance documentation</a>
223+ * @since 5.2.0
224+ */
225+ public static double length (List <Point > coords , String units ) {
217226 double travelled = 0 ;
218227 Point prevCoords = coords .get (0 );
219228 Point curCoords ;
@@ -253,7 +262,21 @@ public static Point midpoint(@NonNull Point from, @NonNull Point to) {
253262 */
254263 public static Point along (@ NonNull LineString line , @ FloatRange (from = 0 ) double distance ,
255264 @ NonNull @ TurfConstants .TurfUnitCriteria String units ) {
256- List <Point > coords = line .coordinates ();
265+ return along (line .coordinates (), distance , units );
266+ }
267+
268+ /**
269+ * Takes a list of points and returns a point at a specified distance along the line.
270+ *
271+ * @param coords that the point should be placed upon
272+ * @param distance along the linestring geometry which the point should be placed on
273+ * @param units one of the units found inside {@link TurfConstants.TurfUnitCriteria}
274+ * @return a {@link Point} which is on the linestring provided and at the distance from
275+ * the origin of that line to the end of the distance
276+ * @since 5.2.0
277+ */
278+ public static Point along (@ NonNull List <Point > coords , @ FloatRange (from = 0 ) double distance ,
279+ @ NonNull @ TurfConstants .TurfUnitCriteria String units ) {
257280
258281 double travelled = 0 ;
259282 for (int i = 0 ; i < coords .size (); i ++) {
0 commit comments