Package org.locationtech.jts.linearref
Class LocationIndexOfPoint
- java.lang.Object
-
- org.locationtech.jts.linearref.LocationIndexOfPoint
-
class LocationIndexOfPoint extends java.lang.Object
Computes theLinearLocation
of the point on a linearGeometry
nearest a givenCoordinate
. The nearest point is not necessarily unique; this class always computes the nearest point closest to the start of the geometry.
-
-
Field Summary
Fields Modifier and Type Field Description private Geometry
linearGeom
-
Constructor Summary
Constructors Constructor Description LocationIndexOfPoint(Geometry linearGeom)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LinearLocation
indexOf(Coordinate inputPt)
Find the nearest location along a linearGeometry
to a given point.static LinearLocation
indexOf(Geometry linearGeom, Coordinate inputPt)
LinearLocation
indexOfAfter(Coordinate inputPt, LinearLocation minIndex)
Find the nearestLinearLocation
along the linearGeometry
to a givenCoordinate
after the specified minimumLinearLocation
.static LinearLocation
indexOfAfter(Geometry linearGeom, Coordinate inputPt, LinearLocation minIndex)
private LinearLocation
indexOfFromStart(Coordinate inputPt, LinearLocation minIndex)
-
-
-
Field Detail
-
linearGeom
private Geometry linearGeom
-
-
Constructor Detail
-
LocationIndexOfPoint
public LocationIndexOfPoint(Geometry linearGeom)
-
-
Method Detail
-
indexOf
public static LinearLocation indexOf(Geometry linearGeom, Coordinate inputPt)
-
indexOfAfter
public static LinearLocation indexOfAfter(Geometry linearGeom, Coordinate inputPt, LinearLocation minIndex)
-
indexOf
public LinearLocation indexOf(Coordinate inputPt)
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
public LinearLocation indexOfAfter(Coordinate inputPt, LinearLocation minIndex)
Find the nearestLinearLocation
along the linearGeometry
to a givenCoordinate
after the specified minimumLinearLocation
. 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
private LinearLocation indexOfFromStart(Coordinate inputPt, LinearLocation minIndex)
-
-