aequilibrae.transit package#

Subpackages#

Submodules#

aequilibrae.transit.column_order module#

aequilibrae.transit.constants module#

class aequilibrae.transit.constants.Constants#

Bases: object

agencies: Dict[str, Any] = {}#
srid: Dict[int, int] = {}#
routes: Dict[int, int] = {}#
trips: Dict[int, int] = {}#
patterns: Dict[int, int] = {}#
pattern_lookup: Dict[int, int] = {}#
stops: Dict[int, int] = {}#
fares: Dict[int, int] = {}#

aequilibrae.transit.date_tools module#

aequilibrae.transit.date_tools.to_seconds(value: Optional[str]) Union[int, Any]#
aequilibrae.transit.date_tools.to_time_string(value: Optional[int]) Optional[str]#
aequilibrae.transit.date_tools.one_day_before(date_object)#
aequilibrae.transit.date_tools.create_days_between(range_start_date, range_end_date)#
aequilibrae.transit.date_tools.day_of_week(date: str)#
aequilibrae.transit.date_tools.format_date(date: str) str#

aequilibrae.transit.gtfs_loader module#

class aequilibrae.transit.gtfs_loader.GTFSReader#

Bases: aequilibrae.utils.worker_thread.WorkerThread

Loader for GTFS data. Not meant to be used directly by the user

signal#
logger = <Logger GTFS Reader (WARNING)>#
set_feed_path(file_path)#

Sets GTFS feed source to be used

Arguments

file_path (str): Full path to the GTFS feed (e.g. ‘D:/project/my_gtfs_feed.zip’)

load_data(service_date: str)#

Loads the data for a respective service date.

Arguments

service_date (str): service date. e.g. “2020-04-01”.

finished()#

finished(self) [signal]

aequilibrae.transit.lib_gtfs module#

class aequilibrae.transit.lib_gtfs.GTFSRouteSystemBuilder(network, agency_identifier, file_path, day='', description='', default_capacities={})#

Bases: aequilibrae.utils.worker_thread.WorkerThread

Container for GTFS feeds providing data retrieval for the importer

signal#
set_capacities(capacities: dict)#

Sets default capacities for modes/vehicles.

Arguments
capacities (dict): Dictionary with GTFS types as keys, each with a list

of 3 items for values for capacities: seated and total i.e. -> “{0: [150, 300],…}”

set_maximum_speeds(max_speeds: pandas.core.frame.DataFrame)#

Sets the maximum speeds to be enforced at segments.

Arguments

max_speeds (pd.DataFrame): Requires 4 fields: mode, min_distance, max_distance, speed. Modes not covered in the data will not be touched and distance brackets not covered will receive the maximum speed, with a warning

dates_available() list#

Returns a list of all dates available for this feed.

Returns

feed dates (list): list of all dates available for this feed

set_allow_map_match(allow=True)#

Changes behavior for finding transit-link shapes. Defaults to True.

Arguments

allow (bool optional): If True, allows uses map-matching in search of precise transit_link shapes. If False, sets transit_link shapes equal to straight lines between stops. In the presence of GTFS raw shapes it has no effect.

map_match(route_types=[3]) None#

Performs map-matching for all routes of one or more types.

Defaults to map-matching Bus routes (type 3) only.

For a reference of route types, see https://developers.google.com/transit/gtfs/reference#routestxt

Arguments

route_types (List[int] or Tuple[int]): Default is [3], for bus only

set_agency_identifier(agency_id: str) None#

Adds agency ID to this GTFS for use on import.

Arguments

agency_id (str): ID for the agency this feed refers to (e.g. ‘CTA’)

set_feed(feed_path: str) None#

Sets GTFS feed source to be used.

Arguments

file_path (str): Full path to the GTFS feed (e.g. ‘D:/project/my_gtfs_feed.zip’)

set_description(description: str) None#

Adds description to be added to the imported layers metadata

Arguments

description (str): Description for this feed (e.g. ‘CTA2019 fixed by John Doe after strong coffee’)

set_date(service_date: str) None#

Sets the date for import without doing any of data processing, which is left for the importer

load_date(service_date: str) None#

Loads the transit services available for service_date

Arguments

service_date (str): Service data contained in this field to be imported (e.g. ‘2019-10-04’)

doWork()#

Alias for execute_import

execute_import()#
save_to_disk()#

Saves all transit elements built in memory to disk

finished()#

finished(self) [signal]

Build the graph for links for a certain mode while splitting the closest links at stops’ projection

Arguments

mode_id (int): Mode ID for which we will build the graph for

aequilibrae.transit.map_matching_graph module#

class aequilibrae.transit.map_matching_graph.MMGraph(lib_gtfs, mtmm)#

Bases: aequilibrae.utils.worker_thread.WorkerThread

Build specialized map-matching graphs. Not designed to be used by the final user

signal#
build_graph_with_broken_stops(mode_id: int, distance_to_project=200)#

Build the graph for links for a certain mode while splitting the closest links at stops’ projection

Arguments

mode_id (int): Mode ID for which we will build the graph for distance_to_project (float, Optional): Radius search for links to break at the stops. Defaults to 50m

connect_node(stop) None#
finished()#

finished(self) [signal]

aequilibrae.transit.parse_csv module#

aequilibrae.transit.parse_csv.parse_csv(file_name: str, column_order=[])#
class aequilibrae.transit.parse_csv.empty#

Bases: object

shape = [0]#

aequilibrae.transit.route_system module#

class aequilibrae.transit.route_system.RouteSystem(database_path)#

Bases: object

load_route_system()#
property conn: sqlite3.Connection#
write_GTFS(path_to_folder: str)#

aequilibrae.transit.transit module#

class aequilibrae.transit.transit.Transit(project)#

Bases: object

default_capacities = {0: [150, 300], 1: [280, 560], 2: [700, 700], 3: [30, 60], 4: [400, 800], 5: [20, 40], 11: [30, 60], 12: [50, 100], 'other': [30, 60]}#
new_gtfs_builder(agency, file_path, day='', description='') aequilibrae.transit.lib_gtfs.GTFSRouteSystemBuilder#

Returns a GTFSRouteSystemBuilder object compatible with the project

Arguments

agency (str): Name for the agency this feed refers to (e.g. ‘CTA’)

file_path (str): Full path to the GTFS feed (e.g. ‘D:/project/my_gtfs_feed.zip’)

day (str, Optional): Service data contained in this field to be imported (e.g. ‘2019-10-04’)

description (str, Optional): Description for this feed (e.g. ‘CTA2019 fixed by John Doe’)

Return

gtfs_feed (StaticGTFS): A GTFS feed that can be added to this network

create_transit_database()#

Creates the public transport database

Module contents#