SIG-Bus

QGIS plugin for GTFS reading, passenger demand integration, and per-line report generation.

Version 0.8.4 (experimental)

SIG-Bus β€” passenger load map by route segment in QGIS

The Problem

QGIS has no native GTFS support beyond basic geometry loading. For a transport engineer analyzing Belo Horizonte's bus network β€” combining route geometry, schedules, and passenger demand β€” the workflow was entirely manual: importing separate files, building joins, and reconciling inconsistencies between line identifiers in the fare system and those in the GTFS feed.

Demand data, published by the City of BH on the open data portal, arrives as CSV files with their own coordinate system and line codes. Without a dedicated tool, combining this data with GTFS required advanced GIS and programming skills β€” a high barrier for anyone who simply needed operational line analyses.

The Solution β€” Project Evolution

2020 β€” PIBIC Start

Research began as an undergraduate research initiative (PIBIC) at CEFET-MG (application filed in 2019), focused on building public transport analysis tools from open data.

2022 β€” Plugin Development

Codebase structured as a PyQGIS plugin with a Qt Designer interface. Implemented a native GTFS reader (adapted from CTU GeoForAll Lab under GPL v2+), requiring no external dependencies beyond QGIS itself.

2025 β€” Science & Technology Week at CEFET-MG

Project presented at CEFET-MG's Science and Technology Week, demonstrating the GTFS + demand integration and per-line load map generation.

v0.2 β€” PDF Report and Clustering

v0.2 consolidated the plugin's base (GTFS read into GeoPackage, demand import, allocation over segments) and added the PDF report, one A4 page per direction, with two maps overlaid on the route geometry: graduated load and K-means clustering of segments.

v0.3 / v0.4 β€” Block Diagram

A time by lane chart where each bar is a trip, with Trips Mode (one lane per line and direction) and Blocks Mode, which infers fleet allocation by chaining trips on the same vehicle through a minimum-fleet greedy heuristic, respecting layover. Needed because BHTrans's GTFS carries no `block_id`. Headway between trips is also shown. v0.4 refined the diagram and reorganized the interface into tabs.

v0.5 β€” Build GTFS and Geocoding

A "Build GTFS" wizard to create a line from scratch (stops, timetable by frequency) and fine-tune it trip by trip in the Block Diagram before saving. Stop address geocoding cascades through Google (optional, key stored in QGIS's user settings, not in the project), Nominatim, and Photon, with an Overpass (OSM) street-name corrector for misspelled streets.

v0.7 / v0.8 β€” GTFS Editing

Adjusting a line's timetable directly on the loaded feed, with a single editor combining block diagram and timetable matrix, validation, and export back to a GTFS feed. See the post on timetable editing.

v0.8.4 β€” Documentation

No functional change: documentation became a website at sigbus.dcamargo.com.br, which the QGIS Plugin Manager now links to.

Key Features

GTFS import and validation: The plugin reads GTFS feeds directly from ZIP files, validates data integrity, and generates synthetic calendars when the feed lacks a `calendar.txt` file. Data is converted to GeoPackage with indexed spatial layers for efficient querying.

Per-stop demand integration: Loads the BHTrans boarding CSV and spatially links demand points to GTFS stops, restricted to each line's dominant service pattern to prevent false matches with nearby parallel routes.

Departure schedule by stop (horarios_paradas): When filtering a line, the plugin automatically generates a point layer with scheduled times for all trips on the selected route β€” `arrival_time`, `departure_time`, `stop_sequence`, `trip_id`, `shape_id`, and `direction_id` per stop. Built from a direct join in the GeoPackage database, this layer enables visualization of service distribution throughout the day.

Segment demand allocation (tramos_demanda): Generates a line layer with accumulated passenger load and trip count per segment for the selected time period. Load is calculated using flow conservation, producing an upper bound on actual occupancy β€” suitable for relative comparison across segments and time periods.

Hourly analysis: Analysis can be restricted to a specific hour (0h to 23h) or run for the full day, with automatic selection of the dominant route shape when a line operates multiple geometric variants.

PDF report with clustering: Since v0.2, the plugin generates a report with two maps (accumulated load and cluster-based segment grouping), with graduated styles applied automatically at the end of processing.

Block Diagram: A time by lane chart where each bar is a trip, with Trips Mode (one lane per line and direction) and Blocks Mode, which infers fleet allocation by chaining trips on the same vehicle through a minimum-fleet greedy heuristic, respecting layover. Headway between trips is shown on the diagram, which supports zoom, pan, and PNG or SVG export.

GTFS Editing: Adjusts the trips of a selected line directly in the feed, without unzipping the .zip or editing `stop_times.txt` by hand. The shift can be applied to the whole trip or only to the departure or arrival time, with intermediate stops redistributed proportionally. The feed is validated before export. See the post on timetable editing.

Build GTFS and Geocoding: A wizard to create a line from scratch (stops, timetable by frequency) and fine-tune it trip by trip in the Block Diagram before saving. Stop address geocoding cascades through Google (optional, key stored in QGIS's user settings, not in the project), Nominatim, and Photon, with an Overpass (OSM) street-name corrector. Nominatim and Photon are limited to 1 request per second, so geocoding a whole line takes minutes.

Technology Stack

Python PyQGIS GDAL GeoPackage / SQLite Qt Designer

Impact

The plugin eliminates the manual integration step between network data (GTFS) and demand data (fare system), letting transport engineers and researchers move directly to operational analysis. Applied to Belo Horizonte's bus network, SIG-Bus enables per-line load studies, identification of critical segments, and hourly passenger distribution analysis β€” all within QGIS, with no external dependencies.