Skip to content

NETEXtoGTFS is a Python tool to convert NeTEx Level 1 & 2 XML files into a valid GTFS feed. Features efficient iterative parsing for large files, automatic merging of inputs, and built-in validation fixes for midnight crossings and data consistency. Generates a zipped GTFS feed ready for use. No external dependencies required.

Notifications You must be signed in to change notification settings

ciospettw/NETEXtoGTFS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NeTEx to GTFS Converter

This tool converts NeTEx XML files (Level 1 and Level 2) into a GTFS feed.

Usage

Run the script from the command line using Python:

python netex_to_gtfs.py --netexlvl1 <path_to_level1_xml> --netexlvl2 <path_to_level2_xml> [--output <output_directory>] [--zip]

Arguments

  • --netexlvl1: Path to the Level 1 NeTEx XML file (Required).
  • --netexlvl2: Path to the Level 2 NeTEx XML file (Required).
  • --output: Directory where the GTFS files will be generated. Default is gtfs_output.
  • --zip: If present, zips the output directory into a .zip file.

Example

python netex_to_gtfs.py --netexlvl1 IT-ITI4-0083_L1.xml --netexlvl2 IT-ITI4-0083_L2.xml --zip

Output

The script generates the following GTFS files in the output directory:

  • agency.txt
  • stops.txt
  • routes.txt
  • trips.txt
  • stop_times.txt
  • calendar_dates.txt
  • shapes.txt (if shape data is available)
  • feed_info.txt

Features

  • Progress Tracking: Visual progress bars for parsing and processing steps.
  • Optimization: Efficiently handles large XML files using iterative parsing.
  • Validation Fixes: Includes logic to handle midnight crossings, deduplicate trips, and filter unused stops.
  • Zipping: Automatically zips the output for easy distribution.

Requirements

  • Python 3.x (Standard library only, no external dependencies)

About

NETEXtoGTFS is a Python tool to convert NeTEx Level 1 & 2 XML files into a valid GTFS feed. Features efficient iterative parsing for large files, automatic merging of inputs, and built-in validation fixes for midnight crossings and data consistency. Generates a zipped GTFS feed ready for use. No external dependencies required.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages