SearchAlongRouteUtils

Utility class designed to optimize search along a route by providing optimal points for this scenario. This reduces network usage by limiting the number of points sent to the API (which can reach several thousand on long routes) and enhances search results for APIs lacking detailed road graph data.

Example statistics for different routes:

Oslo – Malaga (3600 km):

  • Original: 43,666 points

  • Optimized with SearchAlongRouteUtils: 8,230 points

  • Optimized with TurfTransformation (tolerance 0.0): 43,647 points

  • Optimized with TurfTransformation (tolerance 0.01): 411 points

Paris – Quimper (564 km):

  • Original: 7,081 points

  • Optimized with SearchAlongRouteUtils: 1,282 points

  • Optimized with TurfTransformation (tolerance 0.0): 7,079 points

  • Optimized with TurfTransformation (tolerance 0.01): 55 points

London Brixton – London Harlesden (16 km):

  • Original: 903 points

  • Optimized with SearchAlongRouteUtils: 469 points

  • Optimized with TurfTransformation (tolerance 0.0): 903 points

  • Optimized with TurfTransformation (tolerance 0.01): 3 points

Functions

Link copied to clipboard
fun selectPoints(progress: RouteProgress, limit: Int? = null): List<Point>

Selects points starting from the current progress position to the end of the route.

fun selectPoints(route: DirectionsRoute, legIndex: Int = 0, legStepIndex: Int = 0, legStepIntersectionIndex: Int = 0, limit: Int? = null): List<Point>

Selects points starting from a specified leg and step index to the end of the route.