Functions realted to building transfers file.

  • build_transfer_file.py. has been provided to transfers_file.txt. This module requires OSMNX package. Following inputs are required:
    • The graph (if not found on disk) is extracted using OpenStreetMaps

    • For every stop, shortest path comutation is performaed within a radius maximum walking limit.

    • Ensures the transitive closure of footpaths.

    Following additional inputs are required.
    • WALKING_LIMIT (int)- Maximum allowed walking time. Note that the final transfers file can have longer transfers due to transitive closure.

    • CORES (int): Number of codes to be used. Shortest path computation can be done in parallel.

Description

Builds the transfer.txt file.

builders.build_transfer_file.extract_graph(NETWORK_NAME: str, breaker: str)tuple[source]

Extracts the required OSM.

Parameters
  • NETWORK_NAME (str) – name of the network

  • stops_list (list) –

Returns

networkx graph, list of tuple [(stop id, nearest OSM node)]

Examples

>>> G, stops_list = extract_graph("anaheim", breaker)
builders.build_transfer_file.find_transfer_len(source_info: tuple)list[source]

Runs shortest path algorithm from source stop with cutoff limit of WALKING_LIMIT * 2

Parameters

source_info (tuple) – Format (stop id, nearest OSM node)

Returns

list of format: [(bus stop id, osm node id, distance between the two nodes)]

Return type

temp_list (list)

Examples

>>> temp_list = find_transfer_len(source_info)
builders.build_transfer_file.initialize()tuple[source]

Initialize variables for building transfers file.

Returns

print line breaker G: Network graph of NETWORK NAME stops_list (list): CORES (int): Number of codes to be used WALKING_LIMIT (int): Maximum allowed walking time start_time: timestamp object USE_PARALlEL (int): 1 for parallel and 0 for serial GENERATE_LOGFILE (int): 1 to redirect and save a log file. Else 0

Return type

breaker (str)

Warning

Building Transfers file requires OSMnX module.

Examples: >>> breaker, G, stops_list, CORES, WALKING_LIMIT, start_time, USE_PARALlEL, GENERATE_LOGFILE = initialize()

builders.build_transfer_file.post_process(G_new, NETWORK_NAME: str, ini_len: int)None[source]
Post process the transfer file. Following functionality are included:
  1. Checks if the transfers graph is transitively closed.

Parameters
  • transfer_file – GTFS transfers.txt file

  • WALKING_LIMIT (int) – Maximum walking limit

  • NETWORK_NAME (str) – Network name

Returns

None

builders.build_transfer_file.transitive_closure(input_list: tuple)list[source]

Ensures transitive closure of footpath graph

Parameters

input_list (tuple) – list of format [(network graph object)]

Returns

Return type

new_edges (list)