@Test public void testTurfPointOnLinePointsBehindFirstPoint() throws TurfException { List<Point> line = new ArrayList<>(); line.add(Point.fromLngLat(-122.45717525482178, 37.72003306385638)); line.add(Point.fromLngLat(-122.45717525482178, 37.718242366859215)); Point first = line.get(0); List<Point> pts = new ArrayList<>(); pts.add(Point.fromLngLat(-122.45717525482178, 37.72009306385638)); pts.add(Point.fromLngLat(-122.45717525482178, 37.82009306385638)); pts.add(Point.fromLngLat(-122.45716525482177, 37.72009306385638)); pts.add(Point.fromLngLat(-122.45516525482178, 37.72009306385638)); for (Point pt : pts) { Feature snappedFeature = TurfMisc.nearestPointOnLine(pt, line); Point snapped = (Point) snappedFeature.geometry(); assertEquals(first, snapped); } }
@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);  }