Importing GTFS data into your Aimsun Next network

Technical Note #61

By Dimitris Triantafyllos

July 2021

GTFS feeds enable transit or public transport agencies to publish their data, and developers to write applications that use this data in an interoperable way. Dimitris Triantafyllos explores how to import this GTFS data into an Aimsun Next model.

 

What is GTFS?

The General Transit Feed Specification (GTFS), also known as GTFS static or static transit (to differentiate it from the GTFS realtime extension), defines a common format for public transportation (PT) schedules and associated geographic information.

 

GTFS feeds enable PT agencies to publish their data and developers to write applications that use this data in an interoperable way. A GTFS feed is composed of a series of text files collected in a ZIP file. Each file models a particular aspect of PT information: stops, routes, trips, and other schedule data. The details of each file are defined in the GTFS reference document.

 

Where can I find public GTFS feeds?

A list of transit agencies who provide GTFS public feeds is available on the GoogleTransitDataFeed project site.

 

How can I use the GTFS importer in Aimsun Next?

 

Requirements

After downloading the GTFS folder (see link above), verify that it includes the required files: agency.txt, stops.txt, routes.txt, trips.txt, and stop_times.txt.

 

The following files are optional and, if available, can be used to improve the accuracy of the GTFS importer: calendar.txt, calendar_dates.txt, fare_attributes.txt, fare_rules.txt, shapes.txt, frequencies.txt, transfers.txt, and feed_info.txt.

 

Recommended workflow:

  1. Import the transit stops and fix any stops that are placed in the wrong locations.
  2. Import the transit lines, with the stops correctly placed, and verify that the lines have been imported correctly.
  3. Import the timetables of these lines and check that they have been imported correctly.

 

The GTFS importer creates the transit stops, lines, and timetables within the boundaries of the sub-network and/or for the geometry related to a specific scenario.

 

A. To import the transit stops:

 

  1. Select File > Import > GTFS Data to open the GTFS Importer dialog:
    1. In the field Directory, select the path to the GTFS folder.
    2. In the Inputs group box, tick the option Stops. This means that only transit stops are imported.
    3. In the field Subnetwork, select the GTFS subnetwork you want to work with. If you leave this choice as None, the importer will use the whole network.
    4. In the field Scenario, select Dynamic Scenario. The GTFS importer will create the stops according to the geometry configuration of this scenario.
    5. Leave the Search Distance options with their default values.
  1. Press OK. When the import process has finished, a new layer named GTFS_Stops is added to the Project window. This layer contains all stops imported as GKPoint and GKBusStop objects in Aimsun Next. All their corresponding attributes have been imported. External IDs and attributes are imported in both object types.

Tip: You may create a new View Mode with two View Styles (GKPoint and GKBusStop) to verify that the stops have been correctly created on the related sections.

 

B. To import the transit lines:

 

  1. Select File > Import > GTFS Data. In the dialog window, set the same options as above but make sure to tick both Stops and Lines.
  1. When the process has finished, check and fix the transit lines that have been added to the Project window. To do so, check the log window for any warnings or errors during the import process and use the Check and Fix tool on the experiment to validate that all lines have been imported correctly. For each public transport line, the following attributes are created:
    • TripID: trip_id from trips.txt file
    • RouteID: route_id from trips.txt file
    • DirectionID: direction_id from trips.txt file
    • StartDate: start_date from calendar.txt file
    • StartTime: start_time from frequencies.txt file
    • RouteColor: route_color from routes.txt file.
 
  1. Check that the layer PT Network has been created and that all lines were successfully imported to this layer.
  1. Check to make sure that the transit lines are properly connected.

 

C. To import timetables:

 

  1. Select File > Import > GTFS Data. In the dialog window, set the same options as above but this time tick only Timetables.
  2. When the process has finished, check the timetables for each transit line. The following information should have been imported:
  • By default, the timetable’s name will contain a range of dates and weekdays as defined in the file named calendar.txt.
  • The Departure Time will be fixed unless there is frequency information related to the line in the file named frequencies.txt.

 

Advanced Options

 

On the GTFS Importer dialog tab named Optional, you will find several additional options.

  • Prefixes: Since the GTFS is evolving over time, we may need to update frequently the transit info in the Aimsun Next network. To do so, we recommend setting Prefixes for Lines and Timetables.

By setting Prefixes, when the importation is done, the prefix for the Line Name is set in the beginning of the transit line’s Name (i.e. A_4_1) and External ID (A_SCT-PCA-4). For the Timetable is set in the beginning of the Timetable Name (i.e. B_GTFS…). See the examples in the screenshots below:

See the main usages of the Prefixes options below:

 

  1. Keep versions of several GTFS importations over time by setting every time a new prefix code for Lines and Timetables (i.e. set the date of the GTFS period, in the case of different geometry configurations for current and future scenarios). This implies redoing all checks and fixes in the Lines and Timetables after every importation.
  2. Keep all the existing Lines, delete and re-import only their Timetables. This implies doing checks and fixes only for the imported timetables. In this case, you need to set the same prefix for Lines and Timetables as the base GTFS importation.
  3. Manually delete the Lines that no longer exist in the actual network and import only the new Lines and their Timetables. This implies doing checks and fixes only for the new Lines and Timetables. In this case, you need to set the same prefix for Lines and Timetables as the base GTFS importation.

 

  • By default, the GTFS importer reads all the timetables available in the GTFS folder. If you are not interested in importing timetables for the entire period and you are mainly interested in importing a weekday, a Saturday, or a Sunday, then tick Date and specify a date to create transit Lines with a unique timetable for that day. A timetable will be created if the line has a service on that date according to the calendar.txt and txt files.
  • Without activating the option Shapes, the route of the line is connecting the transit stops using the shortest path calculation. You may tick Shapes to create lines that follow the existing shapes, in the shapes.txt file, instead of following the shortest paths between transit stops. Warning: Importing with shapes does not always assure better results because of the need for high-precision matches between the shapes data and the network.
  • Tick Apply Dwell Times to make sure that the offsets defined in the stop times are considered by the simulation (I.e., uncheck Non-Applied Offsets in all timetables).
  • In the box named Ban Sections Inside Layers, tick the layers you do not want to place stops or lines on.
  • In the box named Do Not Place Stops on Road Types, tick the Road Types you do not want to place stops on.

 

 

More technical notes

Importing GTFS data into your Aimsun Next network

July 2021: GTFS feeds enable transit or public transport agencies to publish their data, and developers to write applications that use this data in an interoperable way. Dimitris Triantafyllos explores how to import this GTFS data into an Aimsun Next model.

Aimsun
  • Got a question? Get in touch.

    We are here to help!

SHARE

Cite Aimsun Next

Aimsun Next 24

Aimsun (2024). Aimsun Next 24 User’s Manual, Aimsun Next Version 24.0.0, Barcelona, Spain. Accessed on: April. 16, 2024. [Online].

Available: https://docs.aimsun.com/next/24.0.0/

Aimsun Next 24

@manual {AimsunManual,
title = {Aimsun Next 24 User’s Manual},
author = {Aimsun},
edition = {Aimsun Next 24.0.0},
address = {Barcelona, Spain},
year = {2024. [Online]},
month = {Accessed on: Month, Day, Year},
url = {https://docs.aimsun.com/next/24.0.0},
}​​​​​​​​​​​​​​​

Aimsun Next 24

TY – COMP
T1 – Aimsun Next 24 User’s Manual
A1 – Aimsun
ET – Aimsun Next Version 24.0.0
Y1 – 2024
Y2 – Accessed on: Month, Day, Year
CY – Barcelona, Spain
PB – Aimsun
UR – [In software]. Available:
https://docs.aimsun.com/next/24.0.0/