sortPOIsByDuration

abstract fun sortPOIsByDuration(origin: Coordinate, pois: List<PointOfInterest> = getPOIs().toList()): Single<List<PointOfInterestWithInfo>>

Sorts a list of Points of Interest (POIs) by their estimated travel duration from a given origin.

This function takes an origin coordinate and a list of POIs (defaults to all POIs obtained from getPOIs) and returns a Single emitting a list of POIs sorted by the time it takes to travel from the origin to each POI. The returned list contains PointOfInterestWithInfo objects which encapsulate the original POI and associated travel information.

Return

A Single emitting a list of PointOfInterestWithInfo objects sorted by travel duration from the origin. The list will be sorted in ascending order of duration (shortest duration first). If the origin is the same as a POI, the duration will be 0. If a POI's duration cannot be determined, it will likely be placed at the end of the sorted list, or an error will be propagated through the Single.

Parameters

origin

The Coordinate of the origin location.

pois

An optional list of PointOfInterest objects to be sorted. Defaults to all POIs obtained from getPOIs.