getDistanceOnRoute method

int getDistanceOnRoute(
  1. Coordinates coords,
  2. bool activePart
)

Returns the route distance (meters) from departure at the given coords.

Measures the distance along the route from the departure point to the point closest to coords.

Parameters

  • coords: The geographic coordinates where the distance should be measured.
  • activePart: If true, consider only the active portion of the route; otherwise consider the whole route.

Returns

  • An int representing the distance in meters from route start to the point closest to coords. Returns GemError.general.code (-1) on error.

Implementation

int getDistanceOnRoute(final Coordinates coords, final bool activePart) {
  final OperationResult resultString = objectMethod(
    pointerId,
    'RouteBase',
    'getDistanceOnRoute',
    args: <String, Object>{'coords': coords, 'activePart': activePart},
  );

  return resultString['result'];
}