public final class TurfMisc
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static com.mapbox.geojson.LineString |
lineSlice(com.mapbox.geojson.Point startPt,
com.mapbox.geojson.Point stopPt,
com.mapbox.geojson.Feature line)
Takes a line, a start
Point , and a stop point and returns the line in between those
points. |
static com.mapbox.geojson.LineString |
lineSlice(com.mapbox.geojson.Point startPt,
com.mapbox.geojson.Point stopPt,
com.mapbox.geojson.LineString line)
Takes a line, a start
Point , and a stop point and returns the line in between those
points. |
static com.mapbox.geojson.LineString |
lineSliceAlong(com.mapbox.geojson.Feature line,
double startDist,
double stopDist,
java.lang.String units)
Takes a
LineString , a specified distance along the line to a start Point ,
and a specified distance along the line to a stop point
and returns a subsection of the line in-between those points. |
static com.mapbox.geojson.LineString |
lineSliceAlong(com.mapbox.geojson.LineString line,
double startDist,
double stopDist,
java.lang.String units)
Takes a
LineString , a specified distance along the line to a start Point ,
and a specified distance along the line to a stop point,
returns a subsection of the line in-between those points. |
static com.mapbox.geojson.Feature |
nearestPointOnLine(com.mapbox.geojson.Point pt,
java.util.List<com.mapbox.geojson.Point> coords)
Takes a
Point and a LineString and calculates the closest Point on the
LineString. |
static com.mapbox.geojson.Feature |
nearestPointOnLine(com.mapbox.geojson.Point pt,
java.util.List<com.mapbox.geojson.Point> coords,
java.lang.String units)
Takes a
Point and a LineString and calculates the closest Point on the
LineString. |
@NonNull public static com.mapbox.geojson.LineString lineSlice(@NonNull com.mapbox.geojson.Point startPt, @NonNull com.mapbox.geojson.Point stopPt, @NonNull com.mapbox.geojson.Feature line)
Point
, and a stop point and returns the line in between those
points.startPt
- Starting point.stopPt
- Stopping point.line
- Line to slice.TurfException
- signals that a Turf exception of some sort has occurred.@NonNull public static com.mapbox.geojson.LineString lineSlice(@NonNull com.mapbox.geojson.Point startPt, @NonNull com.mapbox.geojson.Point stopPt, @NonNull com.mapbox.geojson.LineString line)
Point
, and a stop point and returns the line in between those
points.startPt
- used for calculating the lineSlicestopPt
- used for calculating the lineSliceline
- geometry that should be slicedLineString
@NonNull public static com.mapbox.geojson.LineString lineSliceAlong(@NonNull com.mapbox.geojson.Feature line, double startDist, double stopDist, @NonNull java.lang.String units)
LineString
, a specified distance along the line to a start Point
,
and a specified distance along the line to a stop point
and returns a subsection of the line in-between those points.
This can be useful for extracting only the part of a route between two distances.line
- input linestartDist
- distance along the line to starting pointstopDist
- distance along the line to ending pointunits
- one of the units found inside TurfConstants.TurfUnitCriteria
can be degrees, radians, miles, or kilometersTurfException
- signals that a Turf exception of some sort has occurred.@NonNull public static com.mapbox.geojson.LineString lineSliceAlong(@NonNull com.mapbox.geojson.LineString line, double startDist, double stopDist, @NonNull java.lang.String units)
LineString
, a specified distance along the line to a start Point
,
and a specified distance along the line to a stop point,
returns a subsection of the line in-between those points.
This can be useful for extracting only the part of a route between two distances.line
- input linestartDist
- distance along the line to starting pointstopDist
- distance along the line to ending pointunits
- one of the units found inside TurfConstants.TurfUnitCriteria
can be degrees, radians, miles, or kilometersTurfException
- signals that a Turf exception of some sort has occurred.@NonNull public static com.mapbox.geojson.Feature nearestPointOnLine(@NonNull com.mapbox.geojson.Point pt, @NonNull java.util.List<com.mapbox.geojson.Point> coords)
Point
and a LineString
and calculates the closest Point on the
LineString.pt
- point to snap fromcoords
- line to snap to@NonNull public static com.mapbox.geojson.Feature nearestPointOnLine(@NonNull com.mapbox.geojson.Point pt, @NonNull java.util.List<com.mapbox.geojson.Point> coords, @Nullable java.lang.String units)
Point
and a LineString
and calculates the closest Point on the
LineString.pt
- point to snap fromcoords
- line to snap tounits
- one of the units found inside TurfConstants.TurfUnitCriteria
can be degrees, radians, miles, or kilometers