route

fun route(request: RouteRequest): ValhallaResponse

Fetch a route from Valhalla.

This function returns a sealed class with the format you designated. Currently this only supports ValhallaResponse.Json and ValhallaResponse.Osrm formats.

Return

The route response wrapped in a ValhallaResponse sealed class based on the requested format.

Parameters

request

The Valhalla routing request containing locations, costing model, and options.

See also

RouteRequest
DirectionsOptions.Format

Throws

if the Valhalla engine returns an error response.

if an error response cannot be parsed.

if the response JSON cannot be parsed.

if an unsupported format (GPX or PBF) is requested.