docs: @NonNull
    public static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords) {
  
      if (coords.size() < 2) {
        throw new TurfException("Turf nearestPointOnLine requires a List of Points "
          + "made up of at least 2 coordinates.");
      }
  
      Feature closestPt = Feature.fromGeometry(
        Point.fromLngLat(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY));
      closestPt.addNumberProperty("dist", Double.POSITIVE_INFINITY);
  
      for (int i = 0; i < coords.size() - 1; i++) {
        Feature start = Feature.fromGeometry(coords.get(i));
        Feature stop = Feature.fromGeometry(coords.get(i + 1));
        //start
        start.addNumberProperty("dist", TurfMeasurement.distance(
          pt, (Point) start.geometry(), TurfConstants.UNIT_MILES));
        //stop
        stop.addNumberProperty("dist", TurfMeasurement.distance(
          pt, (Point) stop.geometry(), TurfConstants.UNIT_MILES));
        //perpendicular
        double heightDistance = Math.max(
          start.properties().get("dist").getAsDouble(),
          stop.properties().get("dist").getAsDouble()
        );
        double direction = TurfMeasurement.bearing((Point) start.geometry(),
          (Point) stop.geometry());
        Feature perpendicularPt1 = Feature.fromGeometry(
          TurfMeasurement.destination(pt, heightDistance, direction + 90,
            TurfConstants.UNIT_MILES));
        Feature perpendicularPt2 = Feature.fromGeometry(
          TurfMeasurement.destination(pt, heightDistance, direction - 90,
            TurfConstants.UNIT_MILES));
        LineIntersectsResult intersect = lineIntersects(
          ((Point) perpendicularPt1.geometry()).longitude(),
          ((Point) perpendicularPt1.geometry()).latitude(),
          ((Point) perpendicularPt2.geometry()).longitude(),
          ((Point) perpendicularPt2.geometry()).latitude(),
          ((Point) start.geometry()).longitude(),
          ((Point) start.geometry()).latitude(),
          ((Point) stop.geometry()).longitude(),
          ((Point) stop.geometry()).latitude()
        );
  
        Feature intersectPt = null;
        if (intersect != null) {
          intersectPt = Feature.fromGeometry(
            Point.fromLngLat(intersect.horizontalIntersection(), intersect.verticalIntersection()));
          intersectPt.addNumberProperty("dist", TurfMeasurement.distance(pt,
            (Point) intersectPt.geometry(), TurfConstants.UNIT_MILES));
        }
  
        if ((double) start.getNumberProperty("dist")
          < (double) closestPt.getNumberProperty("dist")) {
          closestPt = start;
          closestPt.addNumberProperty(INDEX_KEY, i);
        }
        if ((double) stop.getNumberProperty("dist")
          < (double) closestPt.getNumberProperty("dist")) {
          closestPt = stop;
          closestPt.addNumberProperty(INDEX_KEY, i);
        }
        if (intersectPt != null
          && (double) intersectPt.getNumberProperty("dist")
          < (double) closestPt.getNumberProperty("dist")) {
          closestPt = intersectPt;
          closestPt.addNumberProperty(INDEX_KEY, i);
        }
      }
  
      return closestPt;
    }