Export structure
The export creates a zip containing the following csv files:
- agencies.txt
- stops.txt
- routes.txt
- trips.txt
- stop_times.txt
- calendars.txt
These files are compliant with the GTFS standard as defined in the official documentation.
Google's official documentation: https://developers.google.com/transit/gtfs/reference/
Files processing
agencies.txt
A GTFS Agency is created from a Chouette Company.
| Chouette::Company | GTFS Agency |
|---|---|
| registration_number | agency_id |
| name | agency_name |
| url | agency_url |
| time_zone | agency_timezone |
| phone | agency_phone |
| agency_email |
If the Chouette Company registration_number attribute is empty, the agency_id GTFS attribute will be the Company id attribute.
stops.txt
A GTFS Stop is created from a Chouette StopArea.
When making the StopArea list to export, we fetch all the parents.
| Chouette::StopArea | GTFS Stop |
|---|---|
| registration_number | stop_id |
| name | stop_name |
| latitude | stop_lat |
| longitude | stop_lon |
| comment | stop_desc |
| url | stop_url |
| time_zone | stop_timezone |
If the Chouette StopArea registration_number attribute is empty, the stop_id GTFS attributs will be the StopArea id attribute.
If the Chouette StopArea has a parent, the parent_station GTFS attribute will be the parent GTFS identifier.
If the Chouette StopArea area_type attribute is "zdlp", the location_type GTFS attributs will be "1", otherwise it will be "2".
routes.txt
A GTFS Route is created from a Chouette Line.
| Chouette::Line | GTFS Route |
|---|---|
| registration_number | route_id |
| published_name | route_long_name |
| number | route_short_name |
| type | route_type |
| desc | route_desc |
| url | route_url |
If the Chouette Line registration_number attribute is empty, the route_id GTFS attributs will be the Line id attribute.
If the Chouette Line has a Company, the agency_id GTFS attribute will be the Company GTFS identifier.
If the Chouette Line transport_mode attribute is "rail", the route_type GTFS attribute will be "2", otherwise it will be "3".
calendars.txt
A GTFS Calendar is created from a Chouette TimeTable and its Periods and TimeTableDates.
For each exported Chouette VehicleJourney, we merge all their TimeTables, Periods, and TimeTableDates. This merge give us a period list which we use to produce the GTFS Calendars. We don't need to use any GTFS CalendarDate as the exception days are merged in the periods.
The GTFS Calendars are created with a newly generated service_id.
trips.txt
A GTFS Trip is created from a Chouette VehicleJourney, its Line, and Periods from its TimeTables.
For each Chouette VehicleJourney and each merged period from the last step, we create a GTFS Trip.
The route_id GTFS attribute is the GTFS identifier from the VehicleJourney's Line.
The service_id GTFS attribute is the period GTFS identifier.
The trip_short_name GTFS attribute is the published_journey_name Chouette attribute.
The GTFS Trips are created with a newly generated trip_id.
If the Chouette VehicleJourney's Route wayback attribute "outbound", the direction_id GTFS attribute will be "0", otherwise it will be "1".
stop_times.txt
A GTFS StopTime is created from a Chouette VehicleJourneyAtStop.
For each VehicleJourney's VehicleJourneyAtStop we create a GTFS StopTime for each Trip from the last step.
The stop_id GTFS attribute is the GTFS identifier of the VehicleAtStop's StopArea.
The stop_sequence GTFS attribute is the order of the StopArea in the VehicleJourney's JourneyPattern.
The arrival_time and departure_time GTFS attributes are respectively calculated with the Chouette attributes arrival_time and arrival_day_offset, and departure_time and departure_day_offset (time + 24 x day_offset).