Package org.locationtech.jts.linearref
Class LengthIndexOfPoint
java.lang.Object
org.locationtech.jts.linearref.LengthIndexOfPoint
Computes the length index of the point
on a linear
Geometry
nearest a given Coordinate
.
The nearest point is not necessarily unique; this class
always computes the nearest point closest to
the start of the geometry.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
indexOf
(Coordinate inputPt) Find the nearest location along a linearGeometry
to a given point.static double
indexOf
(Geometry linearGeom, Coordinate inputPt) double
indexOfAfter
(Coordinate inputPt, double minIndex) Finds the nearest index along the linearGeometry
to a givenCoordinate
after the specified minimum index.static double
indexOfAfter
(Geometry linearGeom, Coordinate inputPt, double minIndex) private double
indexOfFromStart
(Coordinate inputPt, double minIndex) private double
segmentNearestMeasure
(LineSegment seg, Coordinate inputPt, double segmentStartMeasure)
-
Field Details
-
linearGeom
-
-
Constructor Details
-
LengthIndexOfPoint
-
-
Method Details
-
indexOf
-
indexOfAfter
-
indexOf
Find the nearest location along a linearGeometry
to a given point.- Parameters:
inputPt
- the coordinate to locate- Returns:
- the location of the nearest point
-
indexOfAfter
Finds the nearest index along the linearGeometry
to a givenCoordinate
after the specified minimum index. If possible the location returned will be strictly greater than theminLocation
. If this is not possible, the value returned will equalminLocation
. (An example where this is not possible is when minLocation = [end of line] ).- Parameters:
inputPt
- the coordinate to locateminIndex
- the minimum location for the point location- Returns:
- the location of the nearest point
-
indexOfFromStart
-
segmentNearestMeasure
private double segmentNearestMeasure(LineSegment seg, Coordinate inputPt, double segmentStartMeasure)
-