OLS クライアントルーティング API

さまざまな車両タイプおよび歩行者モードについて、カスタマイズ可能なルート計算を提供します。

RoutingApi のすべての仕様について は、 RoutingApi を参照してください。

次のページで は、リクエストごとの設定メトリックについて説明します。

Scala
Java
val client = BaseClient()
val routingApi = client.of[RoutingApi]
val result = routingApi
  .calculateRoutes(
    "truck",
    "51.611571,11.351608",
    "51.611571,11.351608",
    Seq("51.611571,11.351608"),
    None,
    Option("fast"),
    Option(0),
    None,
    None,
    None,
    None,
    Seq("polyline"),
    Seq("length,speedLimit")
  )
  .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()));

応答の例については、 開発者ガイドを参照してください

」に一致する結果は 件です

    」に一致する結果はありません