fractionAlong

fun fractionAlong(line: Polyline, point: Point, tolerance: Double): Double

Finds the location on the line nearest the input point, expressed as the fraction along the line's total geodesic length, if the point is within the specified distance from the closest location on the line. Supports true curves.

Return

The length along the line nearest the input point, expressed as the fraction of the line's length between 0.0 and 1.0, or NAN if the point is outside the tolerance.

Since

200.1.0

Parameters

line

The line to locate the point's distance along its length.

point

The point to locate.

tolerance

The maximum distance that a point is allowed to be from the line, in the units of the SpatialReference. If the tolerance is -1, the fraction of the closest location on the line is always returned as long as the point lies between the two ends of the polyline. If the distance from the point to the closest location on the line is greater than the tolerance, or the tolerance is -1 and the point does not lie between the two ends of the polyline, NAN is returned.

Throws

Indicates that line and point do not have equivalent spatial references.