/
GTFS Import

GTFS Import

 

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

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

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

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

GTFS transport mode

GTFS route_type

Netex transport mode and submode

Canonical

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

Transport mode : tram

Transport submode : none

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

Transport mode : metro

Transport submode : none

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

Transport mode : rail

Transport submode : none

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

Transport mode : bus

Transport submode : none

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

Transport mode : water

Transport submode : none

5 - Cable tram. Used for street-level rail cars where the cable runs beneath the vehicle (e.g., cable car in San Francisco).

Transport mode : funicular

Transport submode : streetCableCar

6 - Aerial lift, suspended cable car (e.g., gondola lift, aerial tramway). Cable transport where cabins, cars, gondolas or open chairs are suspended by means of one or more cables.

Transport mode : telecabin

Transport submode : none

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

Transport mode : funicular

Transport submode : none

11 - Trolleybus. Electric buses that draw power from overhead wires using poles.

Transport mode : trolleyBus

Transport submode : none

12 - Monorail. Railway in which the track consists of a single rail or a beam.

Transport mode : rail

Transport submode : monorail

extended

(See https://developers.google.com/transit/gtfs/reference/extended-route-types )

100 - Railway Service

Transport mode : rail

Transport submode : none

103 - Inter Regional Rail Service

Transport mode : rail

Transport submode : interregionalRail

200 - Coach Service

Transport mode : coach

Transport submode : none

204 - Regional Coach Service

Transport mode : coach

Transport submode : regionalCoach

205 - Special Coach Service

Transport mode : coach

Transport submode : specialCoach

208 - Commuter Coach Service

Transport mode : coach

Transport submode : commuterCoach

700 - Bus Service

Transport mode : bus

Transport submode : none

713 - School and Public Service Bus

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

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

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

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".

Related content