Create colorful visualizations of public transport from GTFS (General Transit Feed Specification) public transport datasets. Public transport routes drawn on a map, where the thickness and opacity of the lines is determined by the frequency of the schedules along that route segment. Each primary mode of transportation, as defined in GTFS terms, is represented by a unique color.
- Visualize GTFS routes based on their frequency and route types.
- Renders result as a PDF.
- Multiple color schemes: default, pastel, inferno, earthy, cool.
- Water body visualization (beta).
- Administrative borders (beta).
- Clone this repository:
git clone [email protected]:dragoon/cityliner.git cd cityliner
- Install required dependencies:
pip install -r requirements.txt
- Download Ocean shape file from OpenStreetMap: https://osmdata.openstreetmap.de/data/water-polygons.html (WGS84 Projection) and unzip it into the
oceans
directory. - Download GTFS data with
shapes.txt
file available, see catalog here: https://github.com/MobilityData/mobility-database-catalogs. And place it undergtfs/[place-name]/**
- Download some city/transport company logos if needed and place into
assets/logos/[place-name]/**
.
Run the script using the following command:
python main.py --gtfs gtfs/[place-name] --center [center_coordinates] --poster [other_options]
--gtfs
: Path to the GTFS directory. (Required)--processed-dir
: Path to the directory with intermediate files (defaults to./processed
).--center
: Coordinates of the center in the formatlatitude,longitude
. (Required)--max-dist
: Maximum distance from the center on y-axis (in km). Default is 20 km.--width
: Width of the output drawing (in px).--height
: Height of the output drawing (in px)--poster
: Create a drawing for A0 poster size.--water
: Plot water bodies (beta).--admin-borders
: Plot administrative borders of the city/region determined by the center coordinates (beta).--color-scheme
: Choose a color scheme for the poster. Allowed values are:default
,pastel
,inferno
,earthy
,cool
. Default isdefault
.--logos
: List of logos for the poster (inside./assets/logos/{place-name}/
)
(Either --width
and --height
or --poster
must be provided)
Example Helsinki:
python main.py --gtfs=./gtfs/helsinki --place-name=helsinki --center=60.1706017,24.9414482 --poster --color-scheme=pastel --water --logos "helsinki.svg" "hsl.svg"
See configs for other cities in https://github.com/dragoon/cityliner/blob/master/citylines/process_configs.py
Feel free to fork this repository, open issues, or submit pull requests. Any contribution is welcome!
The gallery photos are licensed under the Creative Commons Attribution
4.0 International license: http://creativecommons.org/licenses/by/4.0/.
This source code is licensed under GNU GPLv3. See the LICENSE
file for more details.
Copyright (c) 2023
Roman Prokofyev <https://prokofyev.ch/>
This project is inspired by Michael Mueller's gtfs-visualizations project, implemented with Node.js and Processing, and my fork: https://github.com/dragoon/gtfs-visualizations, which allowed to process large GTFS files, added actual poster-generation code, and a possibility to restrict the visualization area within a certain radius, among other improvements.
This implementation has been developed from scratch with Python, ReportLab for PDF rendering, different color palettes, and a possibility to visualize water bodies using OpenSteetMap data, among other changes.