Skip to content
GuidesPlaygroundDashboard

Calculate a route between two points

RouteResult routing().route(RoutingRouteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/api/v1/route

Calculate a route between two points

ParametersExpand Collapse
RoutingRouteParams params
RouteRequest routeRequest
ReturnsExpand Collapse
class RouteResult:
Coordinates coordinates

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
List<double>
List<List<double>>
List<List<List<double>>>
List<List<List<List<double>>>>
Type type
One of the following:
POINT("Point")
LINE_STRING("LineString")
POLYGON("Polygon")
MULTI_POINT("MultiPoint")
MULTI_LINE_STRING("MultiLineString")
MULTI_POLYGON("MultiPolygon")
Properties properties
Optional<Double> distance

Total distance in meters

Optional<Double> duration

Estimated duration in seconds

Optional<String> mode

Travel mode used

Type type

Calculate a route between two points

package com.plazafyi.example;

import com.plazafyi.client.PlazaClient;
import com.plazafyi.client.okhttp.PlazaOkHttpClient;
import com.plazafyi.models.GeoJsonGeometry;
import com.plazafyi.models.routing.RouteRequest;
import com.plazafyi.models.routing.RouteResult;
import com.plazafyi.models.routing.RoutingRouteParams;
import java.util.List;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        PlazaClient client = PlazaOkHttpClient.fromEnv();

        RouteRequest params = RouteRequest.builder()
            .destination(GeoJsonGeometry.builder()
                .coordinatesOfNumber(List.of(0.0))
                .type(GeoJsonGeometry.Type.POINT)
                .build())
            .origin(GeoJsonGeometry.builder()
                .coordinatesOfNumber(List.of(0.0))
                .type(GeoJsonGeometry.Type.POINT)
                .build())
            .build();
        RouteResult routeResult = client.routing().route(params);
    }
}
Returns Examples