Skip to content

Actor

The Actor class is the main entry point for calling Valhalla's actions (route, isochrone, matrix, etc.) from Python. It wraps the C++ tyr::actor_t and accepts both JSON strings and Python dict requests.

For request/response schemas, see the Turn-by-Turn API reference and the sibling pages under Public APIs.

Actor

Actor(config: Union[Path, str, dict])

Bases: _Actor

Valhalla's Actor class is used to call its actions, like route, isochrone, matrix etc.

Configuration passed in either by an existing configuration JSON file path or in dict form, e.g. by calling valhalla.config.get_config(). In the latter case a temp file will be created.

For details on parameters for each function consult Valhalla's documentation: https://github.com/valhalla/valhalla/blob/master/docs/docs/api

route

route(req: Union[str, dict]) -> Union[str, dict]

Calculates a route.

locate

locate(req: Union[str, dict]) -> Union[str, dict]

Provides information about nodes and edges.

optimized_route

optimized_route(req: Union[str, dict]) -> Union[str, dict]

Optimizes the order of a set of waypoints.

isochrone

isochrone(req: Union[str, dict]) -> Union[str, dict]

Calculates isochrones and isodistances.

matrix

matrix(req: Union[str, dict]) -> Union[str, dict]

Computes the time and distance between a set of locations and returns them as a matrix table.

trace_route

trace_route(req: Union[str, dict]) -> Union[str, dict]

Map-matching for a set of input locations, e.g. from a GPS.

trace_attributes

trace_attributes(req: Union[str, dict]) -> Union[str, dict]

Returns detailed attribution along each portion of a route calculated from a set of input locations, e.g. from a GPS trace.

height

height(req: Union[str, dict])

Computes the height for a set of input geometries.

transit_available

transit_available(req: Union[str, dict]) -> Union[str, dict]

Lookup if transit stops are available in a defined radius around a set of input locations.

expansion

expansion(req: Union[str, dict]) -> Union[str, dict]

Returns all road segments which were touched by the routing algorithm during the graph traversal.

centroid

centroid(req: Union[str, dict]) -> Union[str, dict]

Returns routes from all the input locations to the minimum cost meeting point of those paths.

status

status(req: Union[str, dict] = '') -> Union[str, dict]

Returns nothing or optionally details about Valhalla's configuration.

tile

tile(req: Union[str, dict]) -> bytes

Returns a vector tile (MVT binary data) with a bounding box feature for the given z/x/y tile coordinates.