aequilibrae.transit.transit_elements package#

Submodules#

aequilibrae.transit.transit_elements.agency module#

class aequilibrae.transit.transit_elements.agency.Agency[source]#

Bases: BasicPTElement

Transit Agency to load into the database

  • agency_id (int): ID for the transit agency

  • agency (str): Name of the transit agency

  • feed_date (str): Date for the transit feed using in the import

  • service_date (str): Date for the route services being imported

  • description (str): Description of the feed

save_to_database(conn: Connection) None[source]#

Saves route to the database

aequilibrae.transit.transit_elements.basic_element module#

class aequilibrae.transit.transit_elements.basic_element.BasicPTElement[source]#

Bases: object

from_row(data: Series)[source]#

aequilibrae.transit.transit_elements.fare module#

class aequilibrae.transit.transit_elements.fare.Fare(agency_id: int)[source]#

Bases: object

Transit Fare

  • fare_id (int): ID of the fare as in the network model

  • fare (str): ID of the fare as in GTFS

  • agency (str): Corresponding agency as inputed during import

  • agency_id (int): ID of the corresponding agency as in the network model

  • price (int): As in GTFS

  • currency (str): As in GTFS

  • payment_method (int): As in GTFS

  • transfer (int): As in GTFS

  • transfer_duration (int): As in GTFS

populate(record: tuple, headers: list) None[source]#

Adds fare information.

save_to_database(conn: Connection) None[source]#

Saves Fare attributes to the database

aequilibrae.transit.transit_elements.fare_rule module#

class aequilibrae.transit.transit_elements.fare_rule.FareRule[source]#

Bases: object

Transit Fare

  • fare_id (int): Fare Id to which this rule applies

  • fare (str): Name of the fare rule

  • route (str): Route ID as in GTFS to which this fare rule applies

  • route_id (int): Route ID as in network model to which this fare rule applies

  • origin (int): Transit zone ID for origin

  • destination (int): Transit zone ID for destination

  • contains (str): As in GTFS

  • agency_id (int): Agency ID as in the network model

  • origin_id (int): Origin zone ID as in the network model

  • destination_id (int): Destination Zone ID as in the network model

populate(record: tuple, headers: list) None[source]#

Adds fare information.

save_to_database(conn: Connection) None[source]#

Saves Fare rules to the database

aequilibrae.transit.transit_elements.mode_correspondence module#

aequilibrae.transit.transit_elements.pattern module#

class aequilibrae.transit.transit_elements.pattern.Pattern(route_id, gtfs_feed)[source]#

Bases: BasicPTElement

Represents a stop pattern for a particular route, as defined in GTFS.

save_to_database(conn: Connection, commit=True) None[source]#

Saves the pattern to the routes table

best_shape() LineString[source]#

Gets the best version of shape available for this pattern

map_match()[source]#

Map matches the route into the network, considering its appropriate shape.

Part of the map-matching process is to find the network links corresponding the pattern’s raw shape, so that method will be called in case it has not been called before.

The basic algorithm behind the map-matching algorithm is described in https://doi.org/10.3141%2F2646-08

In a nutshell, we compute the shortest path between the nodes corresponding to the links to which stops were geographically matched, for each pair of identified links.

We do not consider links that are in perfect sequence, as we found that it introduces severe issues when stops are close to intersections without clear upsides.

When issues are found, we remove the stops in the immediate vicinity of the issue and attempt new path finding. The First and last stops/corresponding links are always kept.

If an error was found, (record for it will show in the log), it is stored within the object.

get_error(what_to_get='culprit') tuple | None[source]#

Returns information on the area of the network a map-matching error occurred

Parameters:

*what_to_get* (str) – The object you want returned. Options are ‘culprit’ and ‘partial_path’

:param : return:

aequilibrae.transit.transit_elements.route module#

class aequilibrae.transit.transit_elements.route.Route(agency_id)[source]#

Bases: BasicPTElement

Transit route element to feed into Transit_routes

  • route_id (str): ID of this route, starting with the agency prefix ID

  • route_short_name (str): Short name as found in the GTFS feed

  • route_long_name (str): Long name as found in the GTFS feed

  • route_desc (str): Route description as found in the GTFS feed

  • route_type (int): Route type (mode) for this transit link

  • route_url (str): Route URL as found in the GTFS feed

  • route_color (str): Route color for mapping as found in the GTFS feed

  • route_text_color (str): Route color (text) for mapping as found in the GTFS feed

  • route_sort_order (int): Route rendering order as found in the GTFS feed

  • agency_id (str): Agency ID

  • seated_capacity (float): Vehicle seated capacity for this route

  • total_capacity (float): Total vehicle capacity for this route

populate(record: tuple, headers: list) None[source]#
save_to_database(conn: Connection, commit=True) None[source]#

Saves route to the database

property data#

aequilibrae.transit.transit_elements.service module#

class aequilibrae.transit.transit_elements.service.Service[source]#

Bases: object

Transit service built with data from calendar.txt and calendar_dates.txt from GTFS

  • service_id (str):

  • monday (int): Flag if the route runs on mondays (1 for True, 0 for False)

  • tuesday (int): Flag if the route runs on tuesdays (1 for True, 0 for False)

  • wednesday (int): Flag if the route runs on wednesdays (1 for True, 0 for False)

  • thursday (int): Flag if the route runs on thursdays (1 for True, 0 for False)

  • friday (int): Flag if the route runs on fridays (1 for True, 0 for False)

  • saturday (int): Flag if the route runs on saturdays (1 for True, 0 for False)

  • sunday (int): Flag if the route runs on sundays (1 for True, 0 for False)

  • start_date (str): Start date for this service

  • end_date (str): End date for this service

  • dates (List[str]): List of all dates for which this service is active between its start and end dates

aequilibrae.transit.transit_elements.stop module#

class aequilibrae.transit.transit_elements.stop.Stop(agency_id: int, record: tuple, headers: list)[source]#

Bases: BasicPTElement

Transit stop as read from the GTFS feed

save_to_database(conn: Connection, commit=True) None[source]#

Saves Transit Stop to the database

property data: list#
get_node_id()[source]#

aequilibrae.transit.transit_elements.trip module#

class aequilibrae.transit.transit_elements.trip.Trip[source]#

Bases: BasicPTElement

Transit trips read from trips.txt

  • trip (str): Trip ID as read from the GTFS feed

  • route (str): Route ID as read from the GTFS feed

  • service_id (str): Service ID as read from the GTFS feed

  • trip_headsign (str): Trip headsign as read from the GTFS feed

  • trip_short_name (str): Trip short name as read from the GTFS feed

  • direction_id (int): Direction ID as read from the GTFS feed

  • block_id (int): Block ID as read from the GTFS feed

  • bikes_allowed (int): Bikes allowed flag as read from the GTFS feed

  • wheelchair_accessible (int): Wheelchair accessibility flag as read from the GTFS feed

  • shape_id (str): Shape ID as read from the GTFS feed

  • trip_id (int): Unique trip_id as it will go into the database

  • route_id (int): Unique Route ID as will be available in the routes table

  • pattern_id (int): Unique Pattern ID for this route/stop-pattern as it will go into the database

  • pattern_hash (str): Pattern ID derived from stops for this route/stop-pattern

  • arrivals (List[int]): Sequence of arrival at stops for this trip

  • departures (List[int]): Sequence of departures from stops for this trip

  • stops (List[Stop]): Sequence of stops for this trip

  • shape (LineString): Shape for this trip. Directly from shapes.txt or rebuilt from sequence of stops

save_to_database(conn: Connection, commit=True) None[source]#

Saves trips to the database

get_trip_id()[source]#

Module contents#