Utilities¶
This documentation page gather all functions contained into samples/utils.py module. If not working, please consider module docstrings.
Here are documented some useful functions for testing the pytempus framework.
-
samples.utils.
road_node_id_from_coordinates
(cur, pt_xy)¶ Return a node stored into the database starting from its coordinates pt_xy
Parameters: - cur – psycopg2 cursor - Database connection cursor
- pt_xt – tuple - point coordinates, as floating numbers
Returns: integer - id of the node that corresponds to ̀pt_xy`
-
samples.utils.
sample_node
(cur)¶ Return a random node id from the tempus node table
Parameters: cur – psycopg2.cursor
- database connexion toolReturns: tuple - node id
-
samples.utils.
get_transport_modes
(cur)¶ Get the available transport modes in the current database
Parameters: cur – psycopg2.cursor
- database connexion toolReturns: dict - id and name for each available transport mode
-
samples.utils.
browse
(vertices, v)¶ Recursively get the itinerary steps between the path origin and x, a selected destination node, and print the intermediary node characteristics at each iteration
Parameters: - vertices – dict -
tempus.IsochroneValue
indexed by node ids - v – integer - id of the node to browse
Returns: tuple - cost per mode and total waiting time to reach the current destination
- vertices – dict -