GTFS Import
- 1 Files processing
- 1.1 agencies.txt
- 1.2 stops.txt
- 1.3 routes.txt
- 1.4 calendars.txt
- 1.5 calendar_dates.txt
- 1.6 trips.txt
- 1.7 stop_times.txt
CSV files must be compliant with the GTFS standard as defined in the official documentation https://gtfs.org/documentation/schedule/reference/ .
GTFS files as examples can be found at the following address: https://developers.google.com/transit/gtfs/examples/gtfs-feed
Chouette tries to import all GTFS datas that it can import in our internal models. We call GTFS checks for mandatories attributes or verify links between models.
Files processing
Files are processed in that order :
agencies.txt
stops.txt
routes.txt
calendars.txt
calendar_dates.txt
trips.txt
stop_times.txt
agencies.txt
GTFS data validation
Mandatory attributes:
agency_id
agency_name
agency_url
agency_timezone
The agency_id attribute isn't mandatory in the GTFS profile, but Chouette::Companies are indexed with this identifier.
GTFS model to Chouette model conversion
A GTFS Agency is converted in a Chouette Company.
GTFS Agency | Chouette Company |
---|---|
agency_id | registration_number |
agency_name | name |
agency_url | url |
agency_timezone | time_zone |
stops.txt
GTFS data validation
Mandatory attributes:
stop_id
stop_name
stop_lat
stop_lon
GTFS model to Chouette model conversion
A GTFS Stop is converted in a Chouette StopArea.
GTFS Stop | Chouette StopArea |
---|---|
stop_id | registration_number |
stop_name | name |
stop_lat | latitude |
stop_lon | longitude |
location_type | area_type |
The Chouette StopArea default kind is "Commercial" and its confirmed_at attribute is the import time.
We use the parent_station GTFS attribute to find and associate the StopArea parent.
If the location_type GTFS attribut is "1" the area_type Chouette attribute will be "zdlp", otherwise it will be "zdep".
routes.txt
GTFS data validation
Mandatory attributes:
route_id
route_short_name
route_long_name
The route_type attribute is mandatory in the GTFS profile but isn't imported in Chouette.
GTFS model to Chouette model conversion
A GTFS Route is converted in a Chouette Line.
GTFS Route | Chouette Line |
---|---|
route_id | registration_number |
route_short_name | number |
route_long_name | name |
route_long_name | published_name |
route_desc | comment |
route_url | url |
We use the agency_id GTFS attribute to find and associate the Company to the Line.
GTFS route types are converted in NeTEx transport mode and submode and the table below explains how :
GTFS transport mode | GTFS route_type | Netex transport mode and submode |
---|---|---|
Canonical |
| Transport mode : tram Transport submode : none |
| Transport mode : metro Transport submode : none | |
| Transport mode : rail Transport submode : none | |
| Transport mode : bus Transport submode : none | |
| Transport mode : water Transport submode : none | |
| Transport mode : funicular Transport submode : streetCableCar | |
| Transport mode : telecabin Transport submode : none | |
| Transport mode : funicular Transport submode : none | |
| Transport mode : trolleyBus Transport submode : none | |
| Transport mode : rail Transport submode : monorail | |
extended (See https://developers.google.com/transit/gtfs/reference/extended-route-types ) |
| Transport mode : rail Transport submode : none |
| Transport mode : rail Transport submode : interregionalRail | |
| Transport mode : coach Transport submode : none | |
| Transport mode : coach Transport submode : regionalCoach | |
| Transport mode : coach Transport submode : specialCoach | |
| Transport mode : coach Transport submode : commuterCoach | |
| Transport mode : bus Transport submode : none | |
| Transport mode : bus Transport submode : schoolAndPublicServiceBus |
calendars.txt
GTFS data validation
Mandatory attributes:
service_id
monday
thuesday
wednesday
thursday
friday
saturday
sunday
start_date
end_date
GTFS model to Chouette model conversion
A GTFS Calendar is converted in a combination of a Chouette Timetable and Period. The Timetable will define the Calendar service days, and its Period the beginning and ending dates of the GTFS Calendar.
GTFS Route | Chouette TimeTable | Chouette Period |
---|---|---|
monday | monday |
|
thuesday | thuesday |
|
wednesday | wednesday |
|
thursday | thursday |
|
friday | friday |
|
saturday | saturday |
|
sunday | sunday |
|
start_date |
| period_start |
end_date |
| period_end |
The service_id GTFS attribute is stored in the Chouette TimeTable comment attribute as: "Calendar [service_id]".
calendar_dates.txt
GTFS data validation
Mandatory attributes:
service_id
date
exception_type
GTFS model to Chouette model conversion
A GTFS CalendarDate is converted in a Chouette Date associated with a TimeTable.
GTFS CalendarDate | Chouette Date |
---|---|
date | date |
exception_type | in_out |
We use the service_id GTFS attribute to find and associate the TimeTable to the Date.
The in_out Chouette attribute is a boolean. If the exception_type GTFS attribute is "1" in_out will be "true", otherwise in_out will be "false".
trips.txt
GTFS data validation
Mandatory attributes:
route_id
service_id
trip_id
GTFS model to Chouette model conversion
A GTFS Trip is converted in a combination of a Chouette Route, JourneyPattern, and VehicleJourney.
If the direction_id GTFS attribute is "1" then the Chouette Route wayback attribute will be "outbound", otherwise wayback will be "outbound".
The Chouette Route published_name and name attributes will be equal to the trip_headsign GTFS attribute if it's present, else to the trip_short_name attribute if it's present, or else to "OUTBOUND" or "INBOUND" depending on the direction_id GTFS attribute.
The Chouette JourneyPattern name attribute is equal to the Chouette Route name.
The Chouette VehicleJourney published_journey_name attribute is will be equal to the trip_short_name GTFS attribute if it exists, or else to the trip_id GTFS attribute.
We use the GTFS attribute route_id to find and associate the Line to the Chouette objects.
We use the GTFS attribute service_id to find and associate the TimeTeble to the VehicleJourney.
stop_times.txt
GTFS data validation
Mandatory attributes:
trip_id
arrival_time
departure_time
stop_id
stop_sequence
GTFS model to Chouette model conversion
A GTFS StopTime is converted in a Chouette VehicleJourneyAtStop.
GTFS StopTime | Chouette VehicleJourneyAtStop |
---|---|
arrival_time | arrival_time |
departure_time | departure_time |
We use the GTFS attribute trip_id to find and associate the VehicleJourney to the VehicleJourneyAtStop.
We use the GTFS attribute stop_id to find and associate the StopArea to the VehicleJourneyAtStop.
The Chouette VehicleJourneyAtStop are ordered in the JourneyPattern associated with the VehicleJourney based on the stop_sequence GTFS attribute.
For times occurring after midnight on the service day, the arrival_time and departure_time GTFS attributes can contain a value greater than 24:00:00. In the Chouette VehicleAtStop, arrival_time and departure_time are stored in a 24h format but we use the arrival_day_offset and departure_day_offset attributes to represent such times. If an hour in the GTFS file is greater than 24:00:00 its corresponding offset will be "1", otherwise it'll be "0".