A set of Python scripts to convert GTFS (General Transit Feed Specification) transit feeds to OpenStreetMap relations that can be imported manually.
This project provides tools to transform public transit data from the GTFS format into OpenStreetMap PTv2 relations. These relations can then be imported into OSM to enhance public transportation mapping. Currently, only bus routes are supported.
- Convert GTFS routes to OSM relations
- Handle stops, routes, and schedule information
- Preserve transit metadata in OSM tags
- Validate conversion output for OSM compatibility
- Python 3.10+
- Required Python packages (see
requirements.txt) - Internet connection (for API access)
-
Clone this repository:
git clone https://github.com/yourusername/gtfstoosm.git cd gtfstoosm -
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
Basic usage example:
python -m gtfstoosm.cli --input path/to/gtfs/feed.zip --output output.oscFor more detailed instructions and options, see the Documentation.
gtfstoosm/
βββ gtfstoosm/ # Main package
β βββ __init__.py
β βββ convert.py # Core conversion logic
β βββ gtfs.py # GTFS data handling
β βββ osm.py # OSM output generation
β βββ utils.py # Utility functions
β βββ cli.py # Command-line interface
βββ docs/ # Documentation
βββ requirements.txt # Python dependencies
βββ LICENSE # MIT License
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.