getClosestSegment method

int getClosestSegment(
  1. Coordinates coord
)

Find the index of the route segment nearest to coord.

Performs a proximity query against the route's segments and returns the zero-based index of the closest segment.

Parameters

  • coord: The coordinates to test against the route geometry.

Returns

  • The index of the closest route segment, or GemError.general.code (-1) on error.

Implementation

int getClosestSegment(final Coordinates coord) {
  final OperationResult resultString = objectMethod(
    pointerId,
    'RouteBase',
    'getClosestSegment',
    args: coord,
  );

  return resultString['result'];
}