@Test public void testTurfPointOnLinePointsOnSidesOfLinesCustomUnit() throws TurfException { List<Point> line = new ArrayList<>(); line.add(Point.fromLngLat(-122.45616137981413, 37.72125936929241)); line.add(Point.fromLngLat(-122.45717525482178, 37.718242366859215)); Point first = line.get(0); Point last = line.get(1); List<Point> pts = new ArrayList<>(); pts.add(Point.fromLngLat(-122.45702505111694, 37.71881098149625)); pts.add(Point.fromLngLat(-122.45733618736267, 37.719235317933844)); pts.add(Point.fromLngLat(-122.45686411857605, 37.72027068864082)); pts.add(Point.fromLngLat(-122.45652079582213, 37.72063561093274)); for (Point pt : pts) { Feature snappedFeature = TurfMisc.nearestPointOnLine(pt, line, TurfConstants.UNIT_MILES); Point snapped = (Point) snappedFeature.geometry(); assertNotEquals(snapped, first); assertNotEquals(snapped, last); } }
@NonNull public static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords) { return nearestPointOnLine(pt, coords, null); }
TurfMisc { @NonNull public static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords) { return nearestPointOnLine(pt, coords, null); } }
TurfMisc { @NonNull public static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords) { return nearestPointOnLine(pt, coords, null); } private  TurfMisc(); }
TurfMisc { @NonNull public static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords) { return nearestPointOnLine(pt, coords, null); } private  TurfMisc(); @NonNull static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt,
                                     @NonNull Feature line); @NonNull static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt,
                                     @NonNull LineString line); @NonNull static LineString lineSliceAlong(@NonNull Feature line,
                                          @FloatRange(from = 0) double startDist,
                                          @FloatRange(from = 0) double stopDist,
                                          @NonNull @TurfConstants.TurfUnitCriteria String units); @NonNull static LineString lineSliceAlong(@NonNull LineString line,
                                          @FloatRange(from = 0) double startDist,
                                          @FloatRange(from = 0) double stopDist,
                                          @NonNull @TurfConstants.TurfUnitCriteria String units); @NonNull static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords); @NonNull static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords,
                                           @Nullable @TurfConstants.TurfUnitCriteria String units); }
TurfMisc { @NonNull public static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords) { return nearestPointOnLine(pt, coords, null); } private  TurfMisc(); @NonNull static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt,
                                     @NonNull Feature line); @NonNull static LineString lineSlice(@NonNull Point startPt, @NonNull Point stopPt,
                                     @NonNull LineString line); @NonNull static LineString lineSliceAlong(@NonNull Feature line,
                                          @FloatRange(from = 0) double startDist,
                                          @FloatRange(from = 0) double stopDist,
                                          @NonNull @TurfConstants.TurfUnitCriteria String units); @NonNull static LineString lineSliceAlong(@NonNull LineString line,
                                          @FloatRange(from = 0) double startDist,
                                          @FloatRange(from = 0) double stopDist,
                                          @NonNull @TurfConstants.TurfUnitCriteria String units); @NonNull static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords); @NonNull static Feature nearestPointOnLine(@NonNull Point pt, @NonNull List<Point> coords,
                                           @Nullable @TurfConstants.TurfUnitCriteria String units);  }