Skip to content

πŸšƒ πŸš‹ GTFS public transport route visualisations

License

Notifications You must be signed in to change notification settings

dragoon/cityliner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

City Pane Trio

Cityliner

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.

Table of Contents

  1. Features
  2. Installation and Setup
  3. Usage
  4. Gallery
  5. Contribution
  6. License
  7. Acknowledgements

Features

  • 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).

Installation and Setup

  1. Clone this repository:
    git clone [email protected]:dragoon/cityliner.git
    cd cityliner
  2. Install required dependencies:
    pip install -r requirements.txt
  3. Download Ocean shape file from OpenStreetMap: https://osmdata.openstreetmap.de/data/water-polygons.html (WGS84 Projection) and unzip it into the oceans directory.
  4. Download GTFS data with shapes.txt file available, see catalog here: https://github.com/MobilityData/mobility-database-catalogs. And place it under gtfs/[place-name]/**
  5. Download some city/transport company logos if needed and place into assets/logos/[place-name]/**.

Usage

Run the script using the following command:

python main.py --gtfs gtfs/[place-name] --center [center_coordinates] --poster [other_options]

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 format latitude,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 is default.
  • --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

Gallery

ZΓΌrich 30km Inferno Scheme Poster Helsinki 30km Default Scheme Poster

Tallinn 30km Pastel Scheme Poster Berlin 50km Cool Scheme Poster

Contribution

Feel free to fork this repository, open issues, or submit pull requests. Any contribution is welcome!

License

Gallery

The gallery photos are licensed under the Creative Commons Attribution
4.0 International license: http://creativecommons.org/licenses/by/4.0/.

Code

This source code is licensed under GNU GPLv3. See the LICENSE file for more details.

Copyright (c) 2023
Roman Prokofyev <https://prokofyev.ch/>

Acknowledgements

This project is inspired by Michael Mueller's gtfs-visualizations repository (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 designed from scratch with Python, with ReportLab used for PDF rendering, and adds a possibility to visualize water bodies using OpenSteetMap data, among other changes.

About

πŸšƒ πŸš‹ GTFS public transport route visualisations

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages