getTimeDistanceCoordinateOnRoute method

TimeDistanceCoordinate getTimeDistanceCoordinateOnRoute(
  1. Coordinates coordinates
)

Find the time-distance coordinate nearest to a reference coordinates.

Returns a TimeDistanceCoordinate describing the closest sampled point on the route to the provided reference coordinates. Useful for snapping user locations to the route or for measurements.

Parameters

  • coordinates: The reference coordinate to find the nearest route sample to.

Returns

Implementation

TimeDistanceCoordinate getTimeDistanceCoordinateOnRoute(
  final Coordinates coordinates,
) {
  final OperationResult resultString = objectMethod(
    pointerId,
    'RouteBase',
    'getTimeDistanceCoordinateOnRoute',
    args: coordinates.toJson(),
  );

  final Map<String, dynamic> timeDistanceJson =
      resultString['result'] as Map<String, dynamic>;

  return TimeDistanceCoordinate.fromJson(timeDistanceJson);
}