aequilibrae.transit.transit_elements#

class aequilibrae.transit.transit_elements.Agency(conn: Connection)[source]#

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

from_row(data: Series)#
save_to_database(conn: Connection) None[source]#

Saves route to the database

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

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 inputted 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

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

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 (text): Transit fare zone ID for origin

  • destination (text): Transit fare zone ID for destination

  • contains (str): As in GTFS

  • agency_id (int): Agency 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

Transit link element.

  • transit_link (int): ID of the transit link (updated when inserted in the database)

  • from_stop (str): Origin of the transit connection

  • to_stop (str): Destination of the transit connection

  • pair (str): Identifier of the stop pair as FROM_ID##TO_ID. For identification only

  • geo (LineString): Geometry of the transit link as direct connection between stops

  • length (float): Link length measured directly from the geometry object

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

  • srid (int): srid of our working database

build_geo(from_point: Point, to_point: Point, gtfs_shape: LineString, previous_end: Point)[source]#

Builds link geometry.

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

Saves Transit link to the database

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

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

best_shape() LineString[source]#

Gets the best version of shape available for this pattern

from_row(data: Series)#
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.

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

Saves the pattern to the routes table

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

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

  • pce (float): Vehicle PCE for this route

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

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

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

Saves route to the database

property data#
class aequilibrae.transit.transit_elements.Service[source]#

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

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

Transit stop as read from the GTFS feed

from_row(data: Series)#
get_node_id()[source]#
save_to_database(conn: Connection, commit=True) None[source]#

Saves Transit Stop to the database

property data: list#
class aequilibrae.transit.transit_elements.Trip[source]#

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

from_row(data: Series)#
get_trip_id()[source]#
save_to_database(conn: Connection, commit=True) None[source]#

Saves trips to the database

Modules