RoutingApi
OLS Client Routing API
It provides customizable route calculations for a variety of vehicle types as well as pedestrian modes.
For the full RoutingApi specification, see RoutingApi.
The following pages describe the per-request configuration and metrics.
Example
val client = BaseClient()
val routingApi = client.of[RoutingApi]
val result = routingApi
.calculateRoutes(
"truck", // transportMode
"51.611571,11.351608", // origin
"51.611571,11.351608", // destination
Seq("51.611571,11.351608"), // via
Option("2019-06-24T01:23:45"), // departureTime
Option(OffsetDateTime.MIN), // arrivalTime
Option("fast"), // routingMode
None, // alternatives
None, // avoid
None, // allow
None, // exclude
Option("metric"), // units
Seq("eng"), // lang
Seq("polyline"), // _return
Seq("length,speedLimit"), // spans
None, // truck
None, // vehicle
None, // ev
None, // fuel
None, // driver
None, // pedestrianLeft_Square_BracketspeedRight_Square_Bracket
None, // xRequestID
None, // scooter
None, // currency
Seq("hrn:here:routing::olp-abc:custom:extension-map:abc-yard-routing"), // customizations
None, // taxi
None, // tolls
Option("here:cm:segment:76771992#*;speed=42"), // maxSpeedOnSegment
None // traffic
)
.executeToEntity()
result
.andThen {
case Success(response: RouterRouteResponse) =>
// do something with the routes
response.getRoutes.forEach(route => println(route.getId))
case Failure(ex) =>
ex.printStackTrace()
}
Await.result(result, Duration.Inf)BaseClient client = BaseClientJava.instance();
RoutingApi routingApi = new RoutingApi(client);
RouterRouteResponse response =
routingApi
.calculateRoutes()
.withTransportMode("truck")
.withOrigin("51.611571,11.351608")
.withDestination("51.611571,11.351608")
.withVia(Collections.singletonList("51.611571,11.351608"))
.withRoutingMode(Optional.of("fast"))
.withAlternatives(Optional.of(0))
.withReturn(Collections.singletonList("polyline"))
.withSpans(Collections.singletonList("length,speedLimit"))
.build()
.executeToEntity()
.toCompletableFuture()
.join();
// do something with the routes
response.getRoutes().forEach(routerRoute -> System.out.println(routerRoute.getId()));Examples of responses can be found in the Developer Guide
Updated 21 days ago