fractionAlong static method

double fractionAlong({
  1. required Polyline line,
  2. required ArcGISPoint point,
  3. required double tolerance,
})

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.

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.

Return Value: 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.

Implementation

static double fractionAlong({
  required Polyline line,
  required ArcGISPoint point,
  required double tolerance,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  return _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_GeometryEngine_fractionAlong(
      line._handle,
      point._handle,
      tolerance,
      errorHandler,
    );
  });
}