segmentForDistance

fun List<RouteCoordinate>.segmentForDistance(distanceAlongRoute: Distance): Segment

Important: This is a Public Preview API. It may be changed or removed at any time.

Finds Segment at given distance along the route using binary search.

Return

Segment at a given distance along the route. If the given distance is less than zero, returns Segment composed of the first two points of the Route. If the given distance is greater than total length of the route then returns Segment composed of the last two points of the Route.

Parameters

distanceAlongRoute

A Distance along the route.