aequilibrae.transit.gtfs package

Submodules

aequilibrae.transit.gtfs.agency module

class aequilibrae.transit.gtfs.agency.Agency

Bases: object

contents of the agency.txt file (from https://developers.google.com/transit/gtfs/reference/)

  • id (agency_id) Optional - The agency_id field is an ID that uniquely identifies a transit agency. A transit feed may represent data from more than one agency. The agency_id is dataset unique. This field is optional for transit feeds that only contain data for a single agency.

  • name (agency_name) Required - The agency_name field contains the full name of the transit agency. Google Maps will display this name.

  • url (agency_url) Required - The agency_url field contains the URL of the transit agency. The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.

  • timezone (agency_timezone) Required - The agency_timezone field contains the timezone where the transit agency is located. Timezone names never contain the space character but may contain an underscore. Please refer to http://en.wikipedia.org/wiki/List_of_tz_zones for a list of valid values. If multiple agencies are specified in the feed, each must have the same agency_timezone.

  • lang (agency_lang) Optional - The agency_lang field contains a two-letter ISO 639-1 code for the primary language used by this transit agency. The language code is case-insensitive (both en and EN are accepted). This setting defines capitalization rules and other language-specific settings for all text contained in this transit agency’s feed. Please refer to http://www.loc.gov/standards/iso639-2/php/code_list.php for a list of valid values.

  • phone (agency_phone) Optional - The agency_phone field contains a single voice telephone number for the specified agency. This field is a string value that presents the telephone number as typical for the agency’s service area. It can and should contain punctuation marks to group the digits of the number. Dialable text (for example, TriMet’s “503-238-RIDE”) is permitted, but the field must not contain any other descriptive text.

  • fare_url (agency_url) Optional - The agency_fare_url specifies the URL of a web page that allows a rider to purchase tickets or other fare instruments for that agency online. The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.

  • email (agency_email) Optional - Contains a single valid email address actively monitored by the agency’s customer service department. This email address will be considered a direct contact point where transit riders can reach a customer service representative at the agency.

aequilibrae.transit.gtfs.calendar_dates module

class aequilibrae.transit.gtfs.calendar_dates.CalendarDates

Bases: object

The calendar_dates table allows you to explicitly activate or disable service IDs by date. You can use it in two ways.

File: Optional

Recommended: Use calendar_dates.txt in conjunction with calendar.txt, where calendar_dates.txt defines any exceptions to the default service categories defined in the calendar.txt file. If your service is generally regular, with a few changes on explicit dates (for example, to accommodate special event services, or a school schedule), this is a good approach. Alternate: Omit calendar.txt, and include ALL dates of service in calendar_dates.txt. If your schedule varies most days of the month, or you want to programmatically output service dates without specifying a normal weekly schedule, this approach may be preferable.

  • service_id (service_id) Required - The service_id contains an ID that uniquely identifies a set of dates when a service exception is available for one or more routes. Each (service_id, date) pair can only appear once in calendar_dates.txt. If the a service_id value appears in both the calendar.txt and calendar_dates.txt files, the information in calendar_dates.txt modifies the service information specified in calendar.txt. This field is referenced by the trips.txt file.

  • date (date) Required - The date field specifies a particular date when service availability is different than the norm. You can use the exception_type field to indicate whether service is available on the specified date. The date field’s value should be in YYYYMMDD format.

  • exception_type (exception_type) Required - The exception_type indicates whether service is available on the date specified in the date field.

    • A value of 1 indicates that service has been added for the specified date.

    • A value of 2 indicates that service has been removed for the specified date.

Suppose a route has one set of trips available on holidays and another set of trips available on all other days. You could have one service_id that corresponds to the regular service schedule and another service_id that corresponds to the holiday schedule. For a particular holiday, you would use the calendar_dates.txt file to add the holiday to the holiday service_id and to remove the holiday from the regular service_id schedule.

aequilibrae.transit.gtfs.gtfs module

class aequilibrae.transit.gtfs.gtfs.GTFS

Bases: object

Reader for GTFS (from https://developers.google.com/transit/gtfs/reference/)

.

To provide a memory container for GTFS that can be:
  • Passed to transit assignment algorithms in memory

  • Edited and saved back to disk

  • Displayed in a GIS environment

get_routes_shapes()
get_routes_stops()
load(path_to_folder)
load_agency() → None
load_calendar()
load_calendar_dates()
load_from_file(file_path, save_db=False, memory_db=False)
load_routes()
load_shapes()
load_stop_times()
load_stops()
load_trips()

aequilibrae.transit.gtfs.gtfs_sqlite_db module

class aequilibrae.transit.gtfs.gtfs_sqlite_db.create_gtfsdb(file_path, save_db, memory_db=False, spatialite_enabled=False, overwrite=False)

Bases: aequilibrae.utils.worker_thread.WorkerThread

converting_gtfs
create_database()
import_gtfs()
set_chunk_size(chunk_size)

aequilibrae.transit.gtfs.parse_csv module

aequilibrae.transit.gtfs.parse_csv.parse_csv(file_name: str, column_order=[])

aequilibrae.transit.gtfs.route module

class aequilibrae.transit.gtfs.route.Route

Bases: object

Represents each one of the routes in a GTFS dataset (from https://developers.google.com/transit/gtfs/reference/)

  • id (route_id) Required The route_id field contains an ID that uniquely identifies a route. The route_id is dataset unique.

  • agency_id (agency_id) Optional The agency_id field defines an agency for the specified route. This value is referenced from the agency.txt file. Use this field when you are providing data for routes from more than one agency.

  • short_name (route_short_name) Required The route_short_name contains the short name of a route. This will often be a short, abstract identifier like “32”, “100X”, or “Green” that riders use to identify a route, but which doesn’t give any indication of what places the route serves. At least one of route_short_name or route_long_name must be specified, or potentially both if appropriate. If the route does not have a short name, please specify a route_long_name and use an empty string as the value for this field.

  • long_name (route_long_name) Required The route_long_name contains the full name of a route. This name is generally more descriptive than the route_short_name and will often include the route’s destination or stop. At least one of route_short_name or route_long_name must be specified, or potentially both if appropriate. If the route does not have a long name, please specify a route_short_name and use an empty string as the value for this field.

  • desc (route_desc) Optional The route_desc field contains a description of a route. Please provide useful, quality information. Do not simply duplicate the name of the route. For example, “A trains operate between Inwood-207 St, Manhattan and Far Rockaway-Mott Avenue, Queens at all times. Also from about 6AM until about midnight, additional A trains operate between Inwood-207 St and Lefferts Boulevard (trains typically alternate between Lefferts Blvd and Far Rockaway).”

  • type (route_type) Required The route_type field describes the type of transportation used on a route. Valid values for this field are:

    • 0 - Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area.

    • 1 - Subway, Metro. Any underground rail system within a metropolitan area.

    • 2 - Rail. Used for intercity or long-distance travel.

    • 3 - Bus. Used for short- and long-distance bus routes.

    • 4 - Ferry. Used for short- and long-distance boat service.

    • 5 - Cable car. Used for street-level cable cars where the cable runs beneath the car.

    • 6 - Gondola, Suspended cable car. Typically used for aerial cable cars where the car is suspended from the cable.

    • 7 - Funicular. Any rail system designed for steep inclines.

  • url (route_url) Optional The route_url field contains the URL of a web page about that particular route. This should be different from the agency_url. The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.

  • color (route_color) Optional In systems that have colors assigned to routes, the route_color field defines a color that corresponds to a route. The color must be provided as a six-character hexadecimal number, for example, 00FFFF. If no color is specified, the default route color is white (FFFFFF). The color difference between route_color and route_text_color should provide sufficient contrast when viewed on a black and white screen. The W3C Techniques for Accessibility Evaluation And Repair Tools document offers a useful algorithm for evaluating color contrast. There are also helpful online tools for choosing contrasting colors, including the snook.ca Color Contrast Check application.

  • text_color (route_text_color) Optional The route_text_color field can be used to specify a legible color to use for text drawn against a background of route_color. The color must be provided as a six-character hexadecimal number, for example, FFD700. If no color is specified, the default text color is black (000000). The color difference between route_color and route_text_color should provide sufficient contrast when viewed on a black and white screen.

  • sort_order (route_sort_order) Optional The route_sort_order field can be used to order the routes in a way which is ideal for presentation to customers. It must be a non-negative integer. Routes with smaller route_sort_order values should be displayed before routes with larger route_sort_order values.

# Routes are associated with trips

aequilibrae.transit.gtfs.stop module

class aequilibrae.transit.gtfs.stop.Stop

Bases: object

Represents each one of the physical stops in a GTFS dataset (from https://developers.google.com/transit/gtfs/reference/)

  • id (stop_id) Required - The stop_id field contains an ID that uniquely identifies a stop, station, or station entrance. Multiple routes may use the same stop. The stop_id is used by systems as an internal identifier of this record (e.g., primary key in database), and therefore the stop_id must be dataset unique.

  • code (stop_code) Optional - The stop_code field contains short text or a number that uniquely identifies the stop for passengers. Stop codes are often used in phone-based transit information systems or printed on stop signage to make it easier for riders to get a stop schedule or real-time arrival information for a particular stop. The stop_code field contains short text or a number that uniquely identifies the stop for passengers. The stop_code can be the same as stop_id if it is passenger-facing. This field should be left blank for stops without a code presented to passengers.

  • name (stop_name) Required - The stop_name field contains the name of a stop, station, or station entrance. Please use a name that people will understand in the local and tourist vernacular.

  • desc (stop_desc) Optional - The stop_desc field contains a description of a stop. Please provide useful, quality information. Do not simply duplicate the name of the stop.

  • lat (stop_lat) Required - The stop_lat field contains the latitude of a stop, station, or station entrance. The field value must be a valid WGS 84 latitude.

  • lon (stop_lon) Required - The stop_lon field contains the longitude of a stop, station, or station entrance. The field value must be a valid WGS 84 longitude value from -180 to 180.

  • zone_id (zone_id) Optional - The zone_id field defines the fare zone for a stop ID. Zone IDs are required if you want to provide fare information using fare_rules.txt. If this stop ID represents a station, the zone ID is ignored.

  • url (stop_url) Optional - The stop_url field contains the URL of a web page about a particular stop. This should be different from the agency_url and the route_url fields. The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.

  • location_type (location_type) Optional - The location_type field identifies whether this stop ID represents a stop, station, or station entrance. If no location type is specified, or the location_type is blank, stop IDs are treated as stops. Stations may have different properties from stops when they are represented on a map or used in trip planning. The location type field can have the following values:

    • 0 or blank - Stop. A location where passengers board or disembark from a transit vehicle.

    • 1 - Station. A physical structure or area that contains one or more stop.

    • 2 - Station Entrance/Exit. A location where passengers can enter or exit a station from the street. The stop entry must also specify a parent_station value referencing the stop ID of the parent station for the entrance.

  • parent_station (parent_station) Optional - For stops that are physically located inside stations, the parent_station field identifies the station associated with the stop. To use this field, stops.txt must also contain a row where this stop ID is assigned location type=1.

    This stop ID represents… This entry’s location type… This entry’s parent_station field contains… A stop located inside a station. 0 or blank The stop ID of the station where this stop is located. The stop referenced by parent_station must have location_type=1. A stop located outside a station. 0 or blank A blank value. The parent_station field doesn’t apply to this stop. A station. 1 A blank value. Stations can’t contain other stations.

  • timezone (stop_timezone) Optional - The stop_timezone field contains the timezone in which this stop, station, or station entrance is located. Please refer to Wikipedia List of Timezones for a list of valid values. If omitted, the stop should be assumed to be located in the timezone specified by agency_timezone in agency.txt. When a stop has a parent station, the stop is considered to be in the timezone specified by the parent station’s stop_timezone value. If the parent has no stop_timezone value, the stops that belong to that station are assumed to be in the timezone specified by agency_timezone, even if the stops have their own stop_timezone values. In other words, if a given stop has a parent_station value, any stop_timezone value specified for that stop must be ignored. Even if stop_timezone values are provided in stops.txt, the times in stop_times.txt should continue to be specified as time since midnight in the timezone specified by agency_timezone in agency.txt. This ensures that the time values in a trip always increase over the course of a trip, regardless of which timezones the trip crosses.

  • wheelchair_boarding (wheelchair_boarding) Optional - The wheelchair_boarding field identifies whether wheelchair boardings are possible from the specified stop, station, or station entrance. The field can have the following values:

    • 0 (or empty) - indicates that there is no accessibility information for the stop

    • 1 - indicates that at least some vehicles at this stop can be boarded by a rider in a wheelchair

    • 2 - wheelchair boarding is not possible at this stop

    When a stop is part of a larger station complex, as indicated by a stop with a parent_station value, the stop’s wheelchair_boarding field has the following additional semantics:
    • 0 (or empty) - the stop will inherit its wheelchair_boarding value from the parent station, if specified in the parent

    • 1 - there exists some accessible path from outside the station to the specific stop / platform

    • 2 - there exists no accessible path from outside the station to the specific stop / platform

    For station entrances, the wheelchair_boarding field has the following additional semantics:
    • 0 (or empty) - the station entrance will inherit its wheelchair_boarding value from the parent station, if specified in the parent

    • 1 - the station entrance is wheelchair accessible (e.g. an elevator is available to platforms if they are not at-grade)

    • 2 - there exists no accessible path from the entrance to station platforms

aequilibrae.transit.gtfs.trip module

class aequilibrae.transit.gtfs.trip.Trip

Bases: object

Module contents