Route

This module provides functionality for working with routes.

class Routing[source]

Bases: object

BASE_ENDPOINT = 'routing/'
classmethod route(api, stops, **kwargs)[source]

Find best driving routes between coordinates and return results.

Parameters:
  • api (GeoboxClient) – The GeoboxClient instance for making requests.

  • stops (str) – Comma-separated list of stop coordinates in the format lon,lat;lon,lat.

Keyword Arguments:
  • alternatives (bool) – Whether to return alternative routes. Default value : False.

  • steps (bool) – Whether to include step-by-step navigation instructions. Default value : False.

  • geometries (RoutingGeometryType) – Format of the returned geometry.

  • overview (RoutingOverviewLevel) – Level of detail in the returned geometry.

  • annotations (bool) – Whether to include additional metadata like speed, weight, etc.

Returns:

the routing output

Return type:

Dict

Example

>>> from geobox import GeoboxClient
>>> from geobox.route import Routing
>>> client = GeoboxClient()
>>> route = routing.route(client,
...                         stops="53,33;56,36",
...                         alternatives=True,
...                         steps=True,
...                         geometries=RoutingGeometryType.geojson,
...                         overview=RoutingOverviewLevel.full,
...                         annotations=True)
or
>>> route = client.route(stops="53,33;56,36",
...                         alternatives=True,
...                         steps=True,
...                         geometries=RoutingGeometryType.geojson,
...                         overview=RoutingOverviewLevel.full,
...                         annotations=True)