Tempus main bindings

This page contains a definition of the existing wrappers that were defined for a range of seminal Tempus functions. These wrappers are stored in module tempus.__init__.

Load a plugin

tempus.load_plugin(options, plugin_name=None, plugin_path=None)

Load a Tempus plugin.

Parameters:
  • options – dict - Database options in a dictionary; the main entry is db/options
  • plugin_name – object - String designing the name of the plugin that must be used (commonly supported: “sample_road_plugin”, “sample_multi_plugin”, “dynamic_multi_plugin”, “sample_pt_plugin”, “isochrone_plugin”)
  • plugin_path – object - Relative path to the plugin sources (alternative to plugin_path parameter, it is considered only if plugin_name is null)
Returns:

tempus.Plugin - routing plugin

Load a graph

tempus.load_graph(options, graph_type='multimodal_graph')

Load a Tempus graph

Parameters:
  • options – dict - Database options as a dictionary; the main entry is db/options
  • graph_type – object - String designing the graph type to be used (supported: “multimodal_graph”, not yet supported: “ch_graph”)
Returns:

tempus.<graph_type>.Graph - routing graph

Do routing requests

This class is defined to contain the routing request results. It is a wrapper that allow to consider the request itself associated with its result.

class tempus.ResultWrapper(plugin_request, results)

Tempus request result wrapper

Instanciated with a Tempus.PluginRequest (containing one or more tempus.ResultElement, i.e. tempus.Roadmap or tempus.Isochrone) and a dict containing the request resolution metrics (i.e number of iterations, execution time)

__getitem__(key)

Result item getter: consider results elements (of tempus.ResultElement)as a list, i.e. they must be accessed through an index key

Parameters:key – integer - id of the result object that must be get
__len__()

built-in result element length; gives the number of stored items in the request result

A binding function request is defined by exploiting this class as follows:

tempus.request(plugin, plugin_options=None, origin=None, steps=None, destination=None, allowed_transport_modes=None, criteria=None, parking_location=None, networks=None)

Request the Tempus database according to the plugin capabilities, to get a shortest path structure between origin and destination nodes that uses only allowed_transport_modes

Parameters:
  • pluginTempus.Plugin - Plugin to use for answering the request (ex: isochrone_plugin)
  • plugin_options – dict - Additional options to feed to the chosen plugin
  • origin – integer - Id of the origin node
  • steps – list - destination specifications (time constraint, parking at destination… for the final destination, or intermediary steps)
  • destination – integer - Id of the destination node
  • allowed_transportation_modes – list - Id of the allowed transportation modes; for having a mode glossary, please refer to your database (tempus.transport_mode)
  • criteria – list - Optimization criteria (supported: tempus.Cost.Duration; not yet supported: tempus.Cost.Distance, tempus.Cost.Calories, tempus.Cost.Carbon, tempus.Cost.Elevation, tempus.Cost.Landmark, tempus.Cost.NumberOfChanges, tempus.Cost.PathComplexity, tempus.Cost.Price, tempus.Cost.Security, tempus.Cost.Variability)
  • parking_location – integer - Parking node id (NOT IMPLEMENTED)
  • networks – integer - Network id (NOT IMPLEMENTED)
Returns:

ResultWrapper - a routing request result and some running metrics