Skip to main content

Convert GTFS transit data to GMNS (General Modeling Network Specification) network files.

Project description

GTFS2GMNS

The open-source Python codes (GTFS2GMNS) is released to facilitate researchers and planners to construct the multi-modal transit networks easily from generic General Transit Feed Specification (GTFS) to the network modeling format in General Modeling Network Specification (GMNS). The converted physical and service networks in GMNS format are more convenient for network modeling tasks such as transit network routing, traffic flow assignment, simulation and service network optimization.

Your comments will be valuable for code review and improvement. Please feel free to add your comments to our Google document of GTFS2GMNS Users' Guide.

Getting Started

1. Download GTFS Data

On TransitFeed homepage, users can browse and download official GTFS feeds from around the world. Make sure that the following files are present, so that we can proceed.

  • stop.txt
  • route.txt
  • trip.txt
  • stop_times.txt
  • agency.txt

GTFS2GMNS can handle the transit data from several agencies. Users need to configure different sub-files in the same directory. Under the test folder, three subfolders Cottonwood_Area_Transit, Flagstaff_MountainLine, and Sedona_RoadRunner with their owm GTFS data is set up.

Convert GTFS Data into GMNS Format

2. Read GTFS data

Step 2.1: Read routes.txt

  • route_id, route_long_name, route_short_name, route_url, route_type

Step 2.2: Read stop.txt

  • stop_id, stop_lat, stop_lon, direction, location_type, position, stop_code, stop_name, zone_id

Step 2.3: Read trips.txt

  • trip_id, route_id, service_id, block_id, direction_id, shape_id, trip_type
  • and create the directed_route_id by combining route_id and direction_id

Step 2.4: Read stop_times.txt

  • trip_id, stop_id, arrival_time, deaprture_time, stop_sequence

  • create directed_route_stop_id by combining directed_route_id and stop_id through the trip_id

    Note: the function needs to skip this record if trip_id is not defined, and link the virtual stop id with corresponding physical stop id.

  • fetch the geometry of the direction_route_stop_id

  • return the arrival_time for every stop

3. Building service network

Step 3.1 Create physical nodes

  • physical node is the original stop in standard GTFS

Step 3.2 Create directed route stop vertexes

  • add route stop vertexes. the node_id of route stop nodes starts from 100001

    Note: the route stop vertex the programing create nearby the corresponding physical node, to make some offset.

  • add entrance link from physical node to route stop node

  • add exit link from route stop node to physical node. As they both connect to the physical nodes, the in-station transfer process can be also implemented

Step 3.3 Create boarding and decoarding arcs

  • add links between each physical node and corresponding route stop vertexes.

Step 3.4 Create transferring arcs

  • add transferring links between physical nodes of different mode.

Step 3.5 Create service arcs

  • add service links between each route stop pair of each trip

4. Output

The output files include node.csv and link.csv.

5. Visualization

You can visualize generated networks using NeXTA or QGIS.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gtfs2gmns-0.8.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gtfs2gmns-0.8.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file gtfs2gmns-0.8.0.tar.gz.

File metadata

  • Download URL: gtfs2gmns-0.8.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for gtfs2gmns-0.8.0.tar.gz
Algorithm Hash digest
SHA256 bd643e955a0b065d43972bea22a107933ce7203ff95fa54c1e327a48daa2f422
MD5 c2c52d1fea3f1a5042fc6c54fd73f026
BLAKE2b-256 a30f5c96228cea5893bce96a783af7e84d945e256c44be19f609cbb9667b8014

See more details on using hashes here.

File details

Details for the file gtfs2gmns-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: gtfs2gmns-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for gtfs2gmns-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5fdf51644a1742ae0fef29a4d28aa70fba00b23f4748b55473b4ecab74742e9
MD5 a29dc1c3e9cff711a78e705e9dee34ec
BLAKE2b-256 3231501ca28b1fe868d705ec704b8b58dc62e4325e28d52413ecd759ab180187

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page