Skip to content
GuidesPlaygroundDashboard

Calculate a route between two points

routing.route(**kwargs) -> RouteResult { geometry, properties, type }
POST/api/v1/route

Calculate a route between two points

ParametersExpand Collapse
destination: GeoJsonGeometry { coordinates, type }

Destination point (GeoJSON Point geometry)

coordinates: Array[Float] | Array[Array[Float]] | Array[Array[Array[Float]]] | Array[Array[Array[Array[Float]]]]

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array[Float]
Array[Array[Float]]
Array[Array[Array[Float]]]
Array[Array[Array[Array[Float]]]]
type: :Point | :LineString | :Polygon | 3 more
One of the following:
:Point
:LineString
:Polygon
:MultiPoint
:MultiLineString
:MultiPolygon
origin: GeoJsonGeometry { coordinates, type }

Origin point (GeoJSON Point geometry)

coordinates: Array[Float] | Array[Array[Float]] | Array[Array[Array[Float]]] | Array[Array[Array[Array[Float]]]]

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array[Float]
Array[Array[Float]]
Array[Array[Array[Float]]]
Array[Array[Array[Array[Float]]]]
type: :Point | :LineString | :Polygon | 3 more
One of the following:
:Point
:LineString
:Polygon
:MultiPoint
:MultiLineString
:MultiPolygon
mode: :auto | :foot | :bicycle
One of the following:
:auto
:foot
:bicycle
ReturnsExpand Collapse
class RouteResult { geometry, properties, type }
geometry: GeoJsonGeometry { coordinates, type }
coordinates: Array[Float] | Array[Array[Float]] | Array[Array[Array[Float]]] | Array[Array[Array[Array[Float]]]]

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array[Float]
Array[Array[Float]]
Array[Array[Array[Float]]]
Array[Array[Array[Array[Float]]]]
type: :Point | :LineString | :Polygon | 3 more
One of the following:
:Point
:LineString
:Polygon
:MultiPoint
:MultiLineString
:MultiPolygon
properties: { distance, duration, mode}
distance: Float

Total distance in meters

duration: Float

Estimated duration in seconds

mode: String

Travel mode used

type: :Feature

Calculate a route between two points

require "plaza"

plaza = Plaza::Client.new(
  api_key: "My API Key",
  environment: "local" # defaults to "production"
)

route_result = plaza.routing.route(
  destination: {coordinates: [0], type: :Point},
  origin: {coordinates: [0], type: :Point}
)

puts(route_result)
Returns Examples