transit agencies table structure

transit agencies table structure#

The Transit_agencies table holds information on all the transit agencies for which there are transit services included in the model. information for these agencies include the GTFS feed (feed_date) and operation day (service_date) for which services were imported into the model.

Encoding of ids for transit agencies, routes, patterns and trips follows a strict encoding that allow one to trace back each element to its parent (Agency->Route->Pattern->Trip). This encoding follows the following pattern: AARRRPPTTT. Since this IDs are always integer, those corresponding to agencies 1 through 9 will omit the first 0 in the ID pattern shown above.

Many fields are not used during POLARIS simulation, and are stored only so a GTFS export after editing remains consistent with the GTFS originally imported. These fields are marked with “Not used by POLARIS” in the comments below.

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

agency_id*

INTEGER

NO

ID of the agency. 1 is reserved for a dummy agency for walking links

agency

TEXT

NO

Display name of the agency. Defaults to the user-supplied identifier when overriding a single-agency feed; otherwise falls back to agency.txt’s agency_name.

feed_date

TEXT

YES

Release date for the GTFS feed used

service_date

TEXT

YES

The service date used for importing the GTFS feed

description

TEXT

YES

User notes (applied to every agency in the feed at import time)

agency_url

TEXT

YES

URL of the transit agency, as found in agency.txt. Not used by POLARIS

timezone

TEXT

NO

‘UTC’

Timezone of the transit agency, as found in agency.txt. All agencies in a feed share the same timezone per GTFS spec. Not used by POLARIS

lang

TEXT

YES

BCP 47 language code for the agency’s primary language, as found in agency.txt. Not used by POLARIS

phone

TEXT

YES

Voice telephone number for the agency, as found in agency.txt. Not used by POLARIS

fare_url

TEXT

YES

URL of a web page with fare information for the agency, as found in agency.txt. Not used by POLARIS

email

TEXT

YES

Email address actively monitored by the agency’s customer service, as found in agency.txt. Not used by POLARIS

gtfs_agency_id

TEXT

YES

Original agency_id string from the GTFS agency.txt file, Not used by POLARIS

gtfs_agency_name

TEXT

YES

Original agency_name from the GTFS agency.txt file. Not used by POLARIS

(* - Primary key)

The SQL statement for table and index creation is below.

create TABLE IF NOT EXISTS Transit_Agencies(
    agency_id           INTEGER NOT NULL  PRIMARY KEY AUTOINCREMENT,
    agency              TEXT    NOT NULL,
    feed_date           TEXT,
    service_date        TEXT,
    description         TEXT,
    agency_url          TEXT,
    timezone            TEXT    NOT NULL DEFAULT 'UTC',
    lang                TEXT,
    phone               TEXT,
    fare_url            TEXT,
    email               TEXT,
    gtfs_agency_id      TEXT,
    gtfs_agency_name    TEXT
);
create UNIQUE INDEX IF NOT EXISTS idx_polaris_transit_operators_id ON Transit_Agencies (agency_id);