Skip to content

02: Adding a route

Mordy Ovits edited this page Jul 17, 2026 · 4 revisions

Overview

In step 1 you imported the static GTFS data source. Now you can add your routes. A route is an origin station stop and a destination station stop on a transit line, e.g. "from Grand Central to Stamford on the Hudson Line".

GTFS2 helps you define routes by letting you pick station stops from the GTFS data you imported, rather than manually entering their sometimes incrutable IDs. However, this depends on the GTFS data providers: some try to be complete and clear, while others may provide only abbreviations.

IMPORTANT: Even though you specify a specific bus/tram/metro line when you configure a route, GTFS2 will only use the origin and destination station stops when making decision based on the route. The line selection in configuring a route is only an aid help you find the stops. By only using a route's origin and destination stations stops, GTFS2 can identify other means of public transport that serve the same origin station stop and destination station stop.

Note: The first time you add route from an imported GTFS data source GTFS2 will add indexes to the database. This may take some time, but it's a one-time process. Adding other routes from the data source routes will be faster.

Add a route

From the Main Menu, click "Create schedule on start/end stops":

main menu

Select a data source

Choose which imported GTFS data source you will using to create the route:

select source

Note: Don't try to proceed until the GTFS data source was fully imported. While the data is being imported the source will become visible for selection but it will not allow you to continue.

Choose a stop selection method

choose stop selection method

There are two methods for selecting the origin and destination of the route you are configuring.

Why are there two methods for selecting a route's stops? Mostly because of how trains are represented in GTFS data. A single train station often show up as multiple stops. in those cases, you would have to pick both the origin and destination stop correctly from all the stops of that single station. Picking the wrong stop within the train station would not work. That is a tedious and error-prone activity. So there's a second selection method where you enter 'city' as a start and end, and all stops will be queried by GTFS. For more info, see the page on setting up a route using city names.

Method 1: Choose by station stops

The first option is "All but trains, between selected stops". With this method you will choose the origin and destination station stops by their name from the imported GTFS data source. This is the one where you choose stops from the GTFS dataa. If the GTFS stops data is not confusing (e.g. does not have stations that are many stops), then you should choose this method.

Method 2: Choose by city

The second option is "Trains only, between manually entered cities". With this method you will choose by city. See the documentation for that method

Using the "Choose by station stops" method

Choose a line and a direction

line name and outbound

Choose a line from dropdown. The dropdown's available choices are populated from the lines defines in the GTFS data source. Then pick a Direction. Depending on the GTFS provider, Outbound or Return may not be in named line, so you may need to try both Outbound and Return.

Note: The GTFS specification does not define what the "direction" really means. There is only a 0 and 1 direction, and the only requirement is consistency in what each mean for that provider.

Choose the origin and destination stops

origin destination name

Select the origin station stop and the destination station stop from their respective dropdowns. Then name the route something clear, and preferably short.

You can check "Include tomorrow" if you want the create route entity to also include tomorrow's schedule.

Name the device and assign it to an area

name and assign

You can choose the name of the device. You can also optionally assign the device to an area.

Confirming the route's attributes

In Developer Tools > States you can see the new entity:

image

You should click the entity you created and examine its attributes to make sure they are what you expected.

Example content of a route's sensor entity:

arrival: "2023-12-17T06:45:00+00:00"
day: today
first: true
last: false
offset: 0
agency_agency_id: busazur
agency_agency_name: Palmbus
agency_agency_url: https://www.palmbus.fr
agency_agency_timezone: Europe/Paris
agency_agency_lang: fr
agency_agency_phone: "0825825599"
agency_agency_fare_url: https://www.palmbus.fr/fr/acheter-son-titre/35
agency_agency_email: commercial-palmbus@palmbus.fr
origin_station_stop_id: GSNF0R
origin_station_stop_code: None
origin_station_stop_name: Gare SNCF de Cannes
origin_station_stop_desc: None
origin_station_stop_lat: "43.553645169596614"
origin_station_stop_lon: "7.019986063282887"
origin_station_zone_id: None
origin_station_stop_url: None
origin_station_location_type: "0"
origin_station_parent_station: Station Gare SNCF de Cannes
origin_station_stop_timezone: None
origin_station_wheelchair_boarding: "1"
origin_station_platform_code: None
origin_station_location_type_name: Station
origin_station_wheelchair_boarding_available: true
destination_station_stop_id: MSCE0A
destination_station_stop_code: None
destination_station_stop_name: Mouans-Sartoux Centre
destination_station_stop_desc: None
destination_station_stop_lat: "43.618942880622285"
destination_station_stop_lon: "6.971753137085002"
destination_station_zone_id: None
destination_station_stop_url: None
destination_station_location_type: "0"
destination_station_parent_station: None
destination_station_stop_timezone: None
destination_station_wheelchair_boarding: "1"
destination_station_platform_code: None
destination_station_location_type_name: Station
destination_station_wheelchair_boarding_available: true
route_route_id: B
route_agency_id: busazur
route_route_short_name: B
route_route_long_name: Mouans Sartoux Centre - Lycée Carnot - Gare SNCF de Cannes
route_route_desc: None
route_route_type: "3"
route_route_url: None
route_route_color: 0277bd
route_route_text_color: FFFFFF
route_type_name: Bus
trip_route_id: B
trip_service_id: 115_SCO_DIM_V12
trip_trip_id: "1115644423119"
trip_trip_headsign: Mouans-Sartoux Centre
trip_trip_short_name: None
trip_direction_id: "0"
trip_block_id: None
trip_shape_id: "55"
trip_wheelchair_accessible: None
trip_bikes_allowed: "2"
trip_bikes_allowed_state: false
trip_wheelchair_access_available: unknown
origin_stop_arrival_time: "2023-12-17T06:15:00+00:00"
origin_stop_departure_time: "2023-12-17T06:15:00+00:00"
origin_stop_drop_off_type: 0
origin_stop_pickup_type: 0
origin_stop_shape_dist_traveled: 0
origin_stop_sequence: 1
origin_stop_drop_off_type_state: Regular
origin_stop_pickup_type_state: Regular
origin_stop_timepoint_exact: true
destination_stop_arrival_time: "2023-12-17T06:45:00+00:00"
destination_stop_departure_time: "2023-12-17T06:45:00+00:00"
destination_stop_drop_off_type: 0
destination_stop_pickup_type: 0
destination_stop_shape_dist_traveled: 9.971
destination_stop_sequence: 29
destination_stop_drop_off_type_state: Regular
destination_stop_pickup_type_state: Regular
destination_stop_timepoint_exact: true
next_departures:
  - "2023-12-17T06:15:00+00:00"
  - "2023-12-17T06:43:00+00:00"
  - "2023-12-17T07:11:00+00:00"
  - "2023-12-17T07:39:00+00:00"
  - "2023-12-17T08:07:00+00:00"
  - "2023-12-17T08:35:00+00:00"
  - "2023-12-17T09:03:00+00:00"
  - "2023-12-17T09:31:00+00:00"
  - "2023-12-17T09:59:00+00:00"
  - "2023-12-17T10:27:00+00:00"
next_departures_lines:
  - >-
    2023-12-17T06:15:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T06:43:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T07:11:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T07:39:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T08:07:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T08:35:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T09:03:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T09:31:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T09:59:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
  - >-
    2023-12-17T10:27:00+00:00 (Mouans Sartoux Centre - Lycée Carnot - Gare SNCF
    de Cannes)
next_departures_headsign:
  - 2023-12-17T06:15:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T06:43:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T07:11:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T07:39:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T08:07:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T08:35:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T09:03:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T09:31:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T09:59:00+00:00 (Mouans-Sartoux Centre)
  - 2023-12-17T10:27:00+00:00 (Mouans-Sartoux Centre)
gtfs_updated_at: "2023-12-17T06:13:17.676488+00:00"
origin_stop_alert: no info
destination_stop_alert: no info
info_realtime: No realtime information
attribution: Palmbus
device_class: timestamp
icon: mdi:bus
friendly_name: Palmbus B to Mouans

Clone this wiki locally